Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ public class AbstractClassPublicConstructor extends Recipe {
final String description = "Constructors of `abstract` classes can only be called in constructors of their subclasses. " +
"Therefore the visibility of `public` constructors are reduced to `protected`.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S5993");
}
@Getter
final Set<String> tags = singleton("RSPEC-S5993");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ public class AddSerialVersionUidToSerializable extends Recipe {
"defined on a `Serializable` class, the compiler will generate this value. If a change is later made " +
"to the class, the generated value will change and attempts to deserialize the class will fail.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S2057");
}
Set<String> tags = singleton("RSPEC-S2057");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ public class AtomicPrimitiveEqualsUsesGet extends Recipe {
@Getter
final String description = "`AtomicBoolean#equals(Object)`, `AtomicInteger#equals(Object)` and `AtomicLong#equals(Object)` are only equal to their instance. This recipe converts `a.equals(b)` to `a.get() == b.get()`.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S2204");
}
@Getter
final Set<String> tags = singleton("RSPEC-S2204");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ public class AvoidBoxedBooleanExpressions extends Recipe {
final String description = "Under certain conditions the `java.lang.Boolean` type is used as an expression, " +
"and it may throw a `NullPointerException` if the value is null.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S5411");
}
@Getter
final Set<String> tags = singleton("RSPEC-S5411");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ public class BigDecimalRoundingConstantsToEnums extends Recipe {
@Getter
final String description = "Convert `BigDecimal` rounding constants to the equivalent `RoundingMode` enum.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S2111");
}
@Getter
final Set<String> tags = singleton("RSPEC-S2111");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ public class BooleanChecksNotInverted extends Recipe {
@Getter
final String description = "Ensures that boolean checks are not unnecessarily inverted. Also fixes double negative boolean expressions.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S1940");
}
@Getter
final Set<String> tags = singleton("RSPEC-S1940");

@Override
public Duration getEstimatedEffortPerOccurrence() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ public class CaseInsensitiveComparisonsDoNotChangeCase extends Recipe {
@Getter
final String description = "Remove `String#toLowerCase()` or `String#toUpperCase()` from `String#equalsIgnoreCase(..)` comparisons.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S1157");
}
@Getter
final Set<String> tags = singleton("RSPEC-S1157");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ public class CatchClauseOnlyRethrows extends Recipe {
final String description = "A `catch` clause that only rethrows the caught exception is unnecessary. " +
"Letting the exception bubble up as normal achieves the same result with less code.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S2737");
}
@Getter
final Set<String> tags = singleton("RSPEC-S2737");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ public Duration getEstimatedEffortPerOccurrence() {
return Duration.ofMinutes(2);
}

@Override
public Set<String> getTags() {
return singleton("RSPEC-S3020");
}
@Getter
final Set<String> tags = singleton("RSPEC-S3020");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ public class CombineSemanticallyEqualCatchBlocks extends Recipe {
final String description = "Combine catches in a try that contain semantically equivalent blocks. " +
"No change will be made when a caught exception exists if combining catches may change application behavior or type attribution is missing.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S2147");
}
@Getter
final Set<String> tags = singleton("RSPEC-S2147");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ public class CompareEnumsWithEqualityOperator extends Recipe {
@Getter
final String description = "Replaces `Enum equals(java.lang.Object)` with `Enum == java.lang.Object`. An `!Enum equals(java.lang.Object)` will change to `!=`.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S4551");
}
@Getter
final Set<String> tags = singleton("RSPEC-S4551");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ public class ControlFlowIndentation extends Recipe {
"only a single statement. This recipe ensures that any statements which follow that statement are correctly " +
"indented to show they are not part of the flow control statement.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S2681");
}
@Getter
final Set<String> tags = singleton("RSPEC-S2681");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ public class CovariantEquals extends Recipe {
final String description = "Checks that classes and records which define a covariant `equals()` method also override method `equals(Object)`. " +
"Covariant `equals()` means a method that is similar to `equals(Object)`, but with a covariant parameter type (any subtype of `Object`).";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S2162");
}
@Getter
final Set<String> tags = singleton("RSPEC-S2162");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ public class DefaultComesLast extends Recipe {
@Getter
final String description = "Ensure the `default` case comes last after all the cases in a switch statement.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S4524");
}
@Getter
final Set<String> tags = singleton("RSPEC-S4524");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/org/openrewrite/staticanalysis/EmptyBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ public class EmptyBlock extends Recipe {
@Getter
final String description = "Remove empty blocks that effectively do nothing.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S108");
}
@Getter
final Set<String> tags = singleton("RSPEC-S108");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ public class EqualsAvoidsNull extends Recipe {
"Also checks for String literals assigned to some field (such as `someString.equals(anotherString = \"text\"))`. " +
"And removes redundant null checks in conjunction with equals comparisons.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S1132");
}
Set<String> tags = singleton("RSPEC-S1132");

@Override
public Duration getEstimatedEffortPerOccurrence() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ public class ExplicitInitialization extends Recipe {
" - and `false` for `boolean`\n" +
"Removes explicit initializations where they aren't necessary.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S3052");
}
@Getter
final Set<String> tags = singleton("RSPEC-S3052");

@Override
public Duration getEstimatedEffortPerOccurrence() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ public class ExplicitLambdaArgumentTypes extends Recipe {
"This does not add explicit types on arguments when the lambda has one or two parameters and does not have a block body, as things are considered more readable in those cases. " +
"For example, `stream.map((a, b) -> a.length);` will not have explicit types added.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S2211");
}
@Getter
final Set<String> tags = singleton("RSPEC-S2211");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ public Duration getEstimatedEffortPerOccurrence() {
return Duration.ofMinutes(20);
}

@Override
public Set<String> getTags() {
return singleton("RSPEC-S2060");
}
@Getter
final Set<String> tags = singleton("RSPEC-S2060");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/org/openrewrite/staticanalysis/FallThrough.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ public class FallThrough extends Recipe {
@Getter
final String description = "Checks for fall-through in switch statements, adding `break` statements in locations where a case contains Java code but does not have a `break`, `return`, `throw`, or `continue` statement.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S128");
}
@Getter
final Set<String> tags = singleton("RSPEC-S128");

@Override
public Duration getEstimatedEffortPerOccurrence() {
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/org/openrewrite/staticanalysis/FinalClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ public class FinalClass extends Recipe {
@Getter
final String description = "Adds the `final` modifier to classes that expose no public or package-private constructors.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S2974");
}
@Getter
final Set<String> tags = singleton("RSPEC-S2974");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ public class FixStringFormatExpressions extends Recipe {
@Getter
final String description = "Fix `String#format` and `String#formatted` expressions by replacing `\\n` newline characters with `%n` and removing any unused arguments. Note this recipe is scoped to only transform format expressions which do not specify the argument index.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S3457");
}
@Getter
final Set<String> tags = singleton("RSPEC-S3457");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ public class ForLoopIncrementInUpdate extends Recipe {
@Getter
final String description = "The increment should be moved to the loop's increment clause if possible.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S1994");
}
@Getter
final Set<String> tags = singleton("RSPEC-S1994");

@Override
public Duration getEstimatedEffortPerOccurrence() {
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/org/openrewrite/staticanalysis/HiddenField.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ public class HiddenField extends Recipe {
@Getter
final String description = "Refactor local variables or parameters which shadow a field defined in the same class.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S1117");
}
@Getter
final Set<String> tags = singleton("RSPEC-S1117");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ public class HideUtilityClassConstructor extends Recipe {
@Getter
final String description = "Ensures utility classes (classes containing only static methods or fields in their API) do not have a public constructor.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S1118");
}
@Getter
final Set<String> tags = singleton("RSPEC-S1118");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ public class IndexOfChecksShouldUseAStartPosition extends Recipe {
@Getter
final String description = "Replaces `indexOf(String)` in binary operations if the compared value is an int and not less than 1.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S2912");
}
@Getter
final Set<String> tags = singleton("RSPEC-S2912");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ public class IndexOfReplaceableByContains extends Recipe {
@Getter
final String description = "Checking if a value is included in a `String` or `List` using `indexOf(value)>-1` or `indexOf(value)>=0` can be replaced with `contains(value)`.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S2692");
}
@Getter
final Set<String> tags = singleton("RSPEC-S2692");

@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ public class IndexOfShouldNotCompareGreaterThanZero extends Recipe {
"with the intent of including all elements. If the intent is to check whether a value in included in a `String` or `List`, " +
"the `String#contains(String)` or `List#contains(Object)` methods may be better options altogether.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S2692");
}
@Getter
final Set<String> tags = singleton("RSPEC-S2692");

@Override
public Duration getEstimatedEffortPerOccurrence() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ public class InlineVariable extends Recipe {
final String description = "Inline variables when they are immediately used to return or throw. " +
"Supports both variable declarations and assignments to local variables.";

@Override
public Set<String> getTags() {
return singleton("RSPEC-S1488");
}
@Getter
final Set<String> tags = singleton("RSPEC-S1488");

@Override
public Duration getEstimatedEffortPerOccurrence() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ public class IsEmptyCallOnCollections extends Recipe {
@Getter
final String description = "Also check for _not_ `isEmpty()` when testing for not equal to zero size.";

@Override
public Set<String> getTags() {
return new LinkedHashSet<>(Arrays.asList("RSPEC-S1155", "RSPEC-S3981"));
}
@Getter
final Set<String> tags = new LinkedHashSet<>(Arrays.asList("RSPEC-S1155", "RSPEC-S3981"));

@Override
public Duration getEstimatedEffortPerOccurrence() {
Expand Down
Loading