jp.skypencil.pmd.slf4j.DontUseStaticLogger Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of RuleSet-for-SLF4J Show documentation
Show all versions of RuleSet-for-SLF4J Show documentation
a simple PMD ruleset for SLF4J
package jp.skypencil.pmd.slf4j;
import net.sourceforge.pmd.ast.ASTClassOrInterfaceType;
import net.sourceforge.pmd.ast.ASTFieldDeclaration;
public final class DontUseStaticLogger extends AbstractSlf4jRule {
@Override
public Object visit(ASTFieldDeclaration node, Object data) {
ASTClassOrInterfaceType field = node.getFirstChildOfType(ASTClassOrInterfaceType.class);
if (field != null && node.isStatic() && fieldIsLogger(field)) {
addViolation(data, node);
}
return super.visit(node, data);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy