-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from openrewrite/support-multiple-sdks
Support multiple SDKs and rebrand to rewrite-feature-flags
- Loading branch information
Showing
39 changed files
with
1,212 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/main/java/org/openrewrite/featureflags/ff4j/RemoveCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openrewrite.featureflags.ff4j; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import lombok.Value; | ||
import org.openrewrite.Option; | ||
import org.openrewrite.Recipe; | ||
import org.openrewrite.featureflags.RemoveBooleanFlag; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
@Value | ||
@EqualsAndHashCode(callSuper = false) | ||
public class RemoveCheck extends Recipe { | ||
|
||
@Option(displayName = "Feature flag key", | ||
description = "The key of the feature flag to remove.", | ||
example = "flag-key-123abc") | ||
String featureKey; | ||
|
||
@Option(displayName = "Replacement value", | ||
description = "The value to replace the feature flag check with.", | ||
example = "true") | ||
Boolean replacementValue; | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Remove FF4j's `check` for feature key"; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Replace `check()` invocations for `featureKey` with `replacementValue`, and simplify constant if branch execution."; | ||
} | ||
|
||
@Override | ||
public List<Recipe> getRecipeList() { | ||
return Collections.singletonList(new RemoveBooleanFlag( | ||
"org.ff4j.FF4j check(String)", | ||
featureKey, replacementValue)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/org/openrewrite/featureflags/ff4j/search/FindFeatureFlag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openrewrite.featureflags.ff4j.search; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import lombok.Value; | ||
import org.openrewrite.Option; | ||
import org.openrewrite.Recipe; | ||
import org.openrewrite.internal.lang.Nullable; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
@Value | ||
@EqualsAndHashCode(callSuper = false) | ||
public class FindFeatureFlag extends Recipe { | ||
|
||
@Option(displayName = "Feature key", | ||
description = "The unique key for the feature flag.", | ||
example = "flag-key-123abc", | ||
required = false) | ||
@Nullable | ||
String featureKey; | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Find a FF4j feature flag"; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Find a FF4j feature flag."; | ||
} | ||
|
||
@Override | ||
public List<Recipe> getRecipeList() { | ||
return Collections.singletonList(new org.openrewrite.featureflags.search.FindFeatureFlag( | ||
"org.ff4j.FF4j check(String, ..)", featureKey)); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/org/openrewrite/featureflags/ff4j/search/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright 2023 the original author or authors. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
@NonNullApi | ||
@NonNullFields | ||
package org.openrewrite.featureflags.ff4j.search; | ||
|
||
import org.openrewrite.internal.lang.NonNullApi; | ||
import org.openrewrite.internal.lang.NonNullFields; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/main/java/org/openrewrite/featureflags/launchdarkly/RemoveBoolVariation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2023 the original author or authors. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openrewrite.featureflags.launchdarkly; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import lombok.Value; | ||
import org.openrewrite.Option; | ||
import org.openrewrite.Recipe; | ||
import org.openrewrite.featureflags.RemoveBooleanFlag; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
@Value | ||
@EqualsAndHashCode(callSuper = false) | ||
public class RemoveBoolVariation extends Recipe { | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Remove LaunchDarkly's `boolVariation` for feature key"; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Replace `boolVariation` invocations for feature key with value, and simplify constant if branch execution."; | ||
} | ||
|
||
@Option(displayName = "Feature flag key", | ||
description = "The key of the feature flag to remove.", | ||
example = "flag-key-123abc") | ||
String featureKey; | ||
|
||
@Option(displayName = "Replacement value", | ||
description = "The value to replace the feature flag check with.", | ||
example = "true") | ||
Boolean replacementValue; | ||
|
||
@Override | ||
public List<Recipe> getRecipeList() { | ||
return Collections.singletonList(new RemoveBooleanFlag( | ||
"com.launchdarkly.sdk.server.LDClient boolVariation(String, com.launchdarkly.sdk.*, boolean)", | ||
featureKey, replacementValue)); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/org/openrewrite/featureflags/launchdarkly/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright 2023 the original author or authors. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
@NonNullApi | ||
@NonNullFields | ||
package org.openrewrite.featureflags.launchdarkly; | ||
|
||
import org.openrewrite.internal.lang.NonNullApi; | ||
import org.openrewrite.internal.lang.NonNullFields; |
Oops, something went wrong.