Class PmdChecker
java.lang.Object
org.jdrupes.builder.core.AbstractProvider
org.jdrupes.builder.core.AbstractGenerator
org.jdrupes.builder.ext.pmd.PmdChecker
- All Implemented Interfaces:
Generator, Renamable, ResourceProvider
A Generator that runs PMD on the project's Java sources.
The PMD ruleset configuration is loaded from a file named
pmd.xml. First, the project's directory is searched. If not
found, the search continues in the parent project's directory and
so on, up to the root project. The configuration path can also be
set explicitly with config(java.nio.file.Path).
Each rule violation is printed to [context().error()]. The
resulting PmdResult contains summary counts and is never flagged
as faulty.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal PmdCheckeraddSources(Path directory, String pattern) Adds the files from the given directory matching the given pattern.final PmdCheckeraddSources(FileTree<JavaSourceFile> sources) Adds the source tree.Sets the path to the PMD ruleset configuration file.protected <T extends Resource>
Collection<T> doProvide(ResourceRequest<T> requested) Invoked byResourceProviderSpi.provide(ResourceRequest)after checking if the invocation is allowed.sources()Returns the source trees configured for the checker.Methods inherited from class AbstractGenerator
cleanup, name, project, toStringMethods inherited from class AbstractProvider
context, name, of, rename, vavrStreamMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ResourceProvider
context, name, of, resources
-
Constructor Details
-
PmdChecker
-
-
Method Details
-
config
Sets the path to the PMD ruleset configuration file. ThePathis resolved against the project's directory when left relative.- Parameters:
configPath- the configuration file path- Returns:
- the PMD checker
-
addSources
Adds the source tree.- Parameters:
sources- the sources- Returns:
- the PMD checker
-
addSources
Adds the files from the given directory matching the given pattern. Short foraddSources(FileTree.of(project(), directory, JavaSourceFile.class, pattern)).- Parameters:
directory- the directorypattern- the pattern- Returns:
- the PMD checker
-
sources
Returns the source trees configured for the checker.- Returns:
- the resources
-
doProvide
Description copied from class:AbstractProviderInvoked byResourceProviderSpi.provide(ResourceRequest)after checking if the invocation is allowed.- Specified by:
doProvidein classAbstractProvider- Type Parameters:
T- the generic type- Parameters:
requested- the request for resources- Returns:
- the stream
-