Find and fix misusage of SLF4J with Google Error Prone
This is a plugin for Google Error Prone, that detects misusage of SLF4J. This provides almost same feature with findbugs-slf4j.
Supported Bug Patterns
Current version supports following bug patterns:
- Slf4jPlaceholderMismatch
- Slf4jFormatShouldBeConst
- Slf4jLoggerShouldBePrivate
- Slf4jLoggerShouldBeFinal
- Slf4jLoggerShouldBeNonStatic
- Slf4jIllegalPassedClass
- Slf4jSignOnlyFormat
- Slf4jDoNotLogMessageOfExceptionExplicitly
Install
After installation of Error Prone, introduce errorprone-slf4j as plugin. Refer official document or following examples:
Maven
maven-compiler-plugin
supports <annotationProcessorPaths>
from version 3.5. Use it in configuration of maven-compiler-plugin
like below:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
...
<annotationProcessorPaths>
<path>
<groupId>jp.skypencil.errorprone.slf4j</groupId>
<artifactId>errorprone-slf4j</artifactId>
<version>0.1.6</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
Gradle
From v4.6, Gradle supports annotationProcessor
configuration so you can configure your project like below:
dependencies {
annotationProcessor 'jp.skypencil.errorprone.slf4j:errorprone-slf4j:0.1.6'
}
Copyright
Copyright 2012-2022 Kengo TODA
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
http://www.apache.org/licenses/LICENSE-2.0
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.