Skip to content

Commit

Permalink
Change severity and tag
Browse files Browse the repository at this point in the history
  • Loading branch information
rickie committed Feb 15, 2021
1 parent 80f1a1e commit 53c84f4
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@
name = "MissingRefasterAnnotation",
summary = "The Refaster template contains a method without Refaster annotation",
linkType = LinkType.NONE,
severity = SeverityLevel.SUGGESTION,
tags = StandardTags.SIMPLIFICATION)
severity = SeverityLevel.WARNING,
tags = StandardTags.LIKELY_ERROR)
public final class MissingRefasterAnnotationCheck extends BugChecker implements ClassTreeMatcher {
private static final long serialVersionUID = 1L;
private static final MultiMatcher<Tree, AnnotationTree> HAS_REFASTER_ANNOTATION =
annotations(
AT_LEAST_ONE,
anyOf(
isType("com.google.errorprone.refaster.annotation.Placeholder"),
isType("com.google.errorprone.refaster.annotation.BeforeTemplate"),
isType("com.google.errorprone.refaster.annotation.AfterTemplate"),
isType("com.google.errorprone.refaster.annotation.Placeholder")));
isType("com.google.errorprone.refaster.annotation.AfterTemplate")));

@Override
public Description matchClass(ClassTree tree, VisitorState state) {
List<MethodTree> normalMethods = new ArrayList<>();
List<MethodTree> refasterAnnotatedMethods = new ArrayList<>();
List<MethodTree> otherMethods = new ArrayList<>();

tree.getMembers().stream()
.filter(member -> member.getKind() == Tree.Kind.METHOD)
Expand All @@ -55,11 +55,11 @@ public Description matchClass(ClassTree tree, VisitorState state) {
if (HAS_REFASTER_ANNOTATION.matches(member, state)) {
refasterAnnotatedMethods.add(member);
} else {
normalMethods.add(member);
otherMethods.add(member);
}
});

if (refasterAnnotatedMethods.isEmpty() || normalMethods.isEmpty()) {
if (refasterAnnotatedMethods.isEmpty() || otherMethods.isEmpty()) {
return Description.NO_MATCH;
}

Expand Down

0 comments on commit 53c84f4

Please sign in to comment.