Skip to content

Latest commit

 

History

History
95 lines (72 loc) · 4.03 KB

README.md

File metadata and controls

95 lines (72 loc) · 4.03 KB

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.

.github/workflows/build.yml Quality Gate Status Maven Central semantic-release

Supported Bug Patterns

Current version supports following bug patterns:

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.20</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.20'
}
with Kotlin DSL
dependencies {
    errorprone("jp.skypencil.errorprone.slf4j:errorprone-slf4j:0.1.20")
}

If you want to disable some rules:

import net.ltgt.gradle.errorprone.errorprone

tasks.withType<JavaCompile>().configureEach {
    options.errorprone {
        disable("Slf4jLoggerShouldBeNonStatic")
    }
}

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.