Class GitIgnoreBuilder
java.lang.Object
org.apache.rat.config.exclusion.fileProcessors.AbstractFileProcessorBuilder
org.apache.rat.config.exclusion.fileProcessors.GitIgnoreBuilder
Processes the
.gitignore
file.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.rat.config.exclusion.fileProcessors.AbstractFileProcessorBuilder
AbstractFileProcessorBuilder.LevelBuilder
-
Field Summary
Fields inherited from class org.apache.rat.config.exclusion.fileProcessors.AbstractFileProcessorBuilder
commentFilter, fileName, REGEX_FMT
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a file processor that processes a.gitignore
file and ignores any lines starting with "#". -
Method Summary
Modifier and TypeMethodDescriptionThe global gitignore file to process, based on the RAT_NO_GIT_GLOBAL_IGNORE, XDG_CONFIG_HOME, and HOME environment variables.modifyEntry
(Consumer<MatcherSet> matcherSetConsumer, DocumentName documentName, String entry) Convert the string entry.protected MatcherSet
process
(Consumer<MatcherSet> matcherSetConsumer, DocumentName root, DocumentName documentName) Process by reading the file, creating a MatcherSet, and adding it to the matcherSets.Methods inherited from class org.apache.rat.config.exclusion.fileProcessors.AbstractFileProcessorBuilder
build, getLevelBuilder, listFiles
-
Constructor Details
-
GitIgnoreBuilder
public GitIgnoreBuilder()Constructs a file processor that processes a.gitignore
file and ignores any lines starting with "#".
-
-
Method Details
-
process
protected MatcherSet process(Consumer<MatcherSet> matcherSetConsumer, DocumentName root, DocumentName documentName) Description copied from class:AbstractFileProcessorBuilder
Process by reading the file, creating a MatcherSet, and adding it to the matcherSets.- Overrides:
process
in classAbstractFileProcessorBuilder
- Parameters:
matcherSetConsumer
- the consumer to add the custom matcher sets to.root
- The root against which to resolve names.documentName
- the file to read.- Returns:
- A matcher set based on the strings in the file.
-
modifyEntry
protected Optional<String> modifyEntry(Consumer<MatcherSet> matcherSetConsumer, DocumentName documentName, String entry) Convert the string entry. If the string ends with a slash anDocumentNameMatcher.and(java.util.Collection<org.apache.rat.document.DocumentNameMatcher>)
is constructed from a directory check and the file name matcher. In this case an empty Optional is returned. If the string starts with "!" then the entry is placed in the include list, otherwise the entry is placed in the exclude list and the name of the check returned.- Overrides:
modifyEntry
in classAbstractFileProcessorBuilder
- Parameters:
documentName
- The name of the document being processed.entry
- The entry from the document- Returns:
- and Optional containing the name of the matcher.
-
globalGitIgnore
The global gitignore file to process, based on the RAT_NO_GIT_GLOBAL_IGNORE, XDG_CONFIG_HOME, and HOME environment variables.
-