Skip to content

Commit

Permalink
fix: add missing BugPattern links (#196)
Browse files Browse the repository at this point in the history
The default linkType in the BugPattern annotation is AUTOGENERATED and
this generates incorrect links such as
https://errorprone.info/bugpattern/Slf4jSignOnlyFormat

Co-authored-by: gtoison <[email protected]>
  • Loading branch information
gtoison and gtoison authored Aug 29, 2022
1 parent 18c967d commit 6a4eac1
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.google.auto.service.AutoService;
import com.google.errorprone.BugPattern;
import com.google.errorprone.VisitorState;
import com.google.errorprone.BugPattern.LinkType;
import com.google.errorprone.bugpatterns.BugChecker;
import com.google.errorprone.bugpatterns.BugChecker.VariableTreeMatcher;
import com.google.errorprone.fixes.SuggestedFix;
Expand All @@ -21,6 +22,8 @@
name = "Slf4jLoggerShouldBePrivate",
summary = "Do not publish Logger field, it should be private",
tags = {"SLF4J"},
link = "https://github.com/KengoTODA/findbugs-slf4j#slf4j_logger_should_be_private",
linkType = LinkType.CUSTOM,
severity = WARNING)
@AutoService(BugChecker.class)
public class DoNotPublishSlf4jLogger extends BugChecker implements VariableTreeMatcher {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.google.common.base.CaseFormat;
import com.google.errorprone.BugPattern;
import com.google.errorprone.VisitorState;
import com.google.errorprone.BugPattern.LinkType;
import com.google.errorprone.bugpatterns.BugChecker;
import com.google.errorprone.bugpatterns.BugChecker.VariableTreeMatcher;
import com.google.errorprone.fixes.SuggestedFix;
Expand All @@ -24,6 +25,8 @@
name = "Slf4jLoggerShouldBeNonStatic",
summary = "Do not use static Logger field, use non-static one instead",
tags = {"SLF4J"},
link = "https://github.com/KengoTODA/findbugs-slf4j#slf4j_logger_should_be_non_static",
linkType = LinkType.CUSTOM,
severity = SUGGESTION)
@AutoService(BugChecker.class)
public class DoNotUseStaticSlf4jLogger extends BugChecker implements VariableTreeMatcher {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.google.auto.service.AutoService;
import com.google.errorprone.BugPattern;
import com.google.errorprone.VisitorState;
import com.google.errorprone.BugPattern.LinkType;
import com.google.errorprone.bugpatterns.BugChecker;
import com.google.errorprone.bugpatterns.BugChecker.MethodInvocationTreeMatcher;
import com.google.errorprone.matchers.CompileTimeConstantExpressionMatcher;
Expand All @@ -18,6 +19,8 @@
name = "Slf4jFormatShouldBeConst",
summary = "Format of SLF4J logging should be constant value",
tags = {"SLF4J"},
link = "https://github.com/KengoTODA/findbugs-slf4j#slf4j_format_should_be_const",
linkType = LinkType.CUSTOM,
severity = ERROR)
@AutoService(BugChecker.class)
public class FormatShouldBeConst extends BugChecker implements MethodInvocationTreeMatcher {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.google.errorprone.BugPattern;
import com.google.errorprone.ErrorProneVersion;
import com.google.errorprone.VisitorState;
import com.google.errorprone.BugPattern.LinkType;
import com.google.errorprone.bugpatterns.BugChecker;
import com.google.errorprone.bugpatterns.BugChecker.MethodInvocationTreeMatcher;
import com.google.errorprone.fixes.SuggestedFix;
Expand Down Expand Up @@ -33,6 +34,8 @@
name = "Slf4jIllegalPassedClass",
summary = "LoggerFactory.getLogger(Class) should get the class that defines variable",
tags = {"SLF4J"},
link = "https://github.com/KengoTODA/findbugs-slf4j#slf4j_illegal_passed_class",
linkType = LinkType.CUSTOM,
severity = WARNING)
@AutoService(BugChecker.class)
public class IllegalPassedClass extends BugChecker implements MethodInvocationTreeMatcher {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.google.auto.service.AutoService;
import com.google.errorprone.BugPattern;
import com.google.errorprone.VisitorState;
import com.google.errorprone.BugPattern.LinkType;
import com.google.errorprone.bugpatterns.BugChecker;
import com.google.errorprone.bugpatterns.BugChecker.MethodInvocationTreeMatcher;
import com.google.errorprone.matchers.Description;
Expand All @@ -21,6 +22,8 @@
summary =
"Do not log message returned from Throwable#getMessage and Throwable#getLocalizedMessage",
tags = {"SLF4J"},
link = "https://github.com/KengoTODA/findbugs-slf4j#slf4j_manually_provided_message",
linkType = LinkType.CUSTOM,
severity = ERROR)
@AutoService(BugChecker.class)
public class ManuallyProvidedMessage extends BugChecker implements MethodInvocationTreeMatcher {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.google.auto.service.AutoService;
import com.google.errorprone.BugPattern;
import com.google.errorprone.VisitorState;
import com.google.errorprone.BugPattern.LinkType;
import com.google.errorprone.bugpatterns.BugChecker;
import com.google.errorprone.bugpatterns.BugChecker.MethodInvocationTreeMatcher;
import com.google.errorprone.matchers.Description;
Expand All @@ -20,6 +21,8 @@
name = "Slf4jPlaceholderMismatch",
summary = "Count of placeholder does not match with count of parameter",
tags = {"SLF4J"},
link = "https://github.com/KengoTODA/findbugs-slf4j#slf4j_place_holder_mismatch",
linkType = LinkType.CUSTOM,
severity = ERROR)
@AutoService(BugChecker.class)
public class PlaceholderMismatch extends BugChecker implements MethodInvocationTreeMatcher {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.google.auto.service.AutoService;
import com.google.errorprone.BugPattern;
import com.google.errorprone.VisitorState;
import com.google.errorprone.BugPattern.LinkType;
import com.google.errorprone.bugpatterns.BugChecker;
import com.google.errorprone.bugpatterns.BugChecker.VariableTreeMatcher;
import com.google.errorprone.fixes.SuggestedFixes;
Expand All @@ -20,6 +21,8 @@
name = "Slf4jLoggerShouldBeFinal",
summary = "Logger field should be final",
tags = {"SLF4J"},
link = "https://github.com/KengoTODA/findbugs-slf4j#slf4j_logger_should_be_final",
linkType = LinkType.CUSTOM,
severity = WARNING)
@AutoService(BugChecker.class)
public class PreferFinalSlf4jLogger extends BugChecker implements VariableTreeMatcher {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.google.auto.service.AutoService;
import com.google.errorprone.BugPattern;
import com.google.errorprone.VisitorState;
import com.google.errorprone.BugPattern.LinkType;
import com.google.errorprone.bugpatterns.BugChecker;
import com.google.errorprone.bugpatterns.BugChecker.MethodInvocationTreeMatcher;
import com.google.errorprone.matchers.CompileTimeConstantExpressionMatcher;
Expand All @@ -18,6 +19,8 @@
name = "Slf4jSignOnlyFormat",
summary = "To make log readable, log format should contain not only sign but also texts",
tags = {"SLF4J"},
link = "https://github.com/KengoTODA/findbugs-slf4j#slf4j_sign_only_format",
linkType = LinkType.CUSTOM,
severity = ERROR)
@AutoService(BugChecker.class)
public class SignOnlyFormat extends BugChecker implements MethodInvocationTreeMatcher {
Expand Down

0 comments on commit 6a4eac1

Please sign in to comment.