Class ExclusionMatcher

java.lang.Object
io.github.sergeloie.languagecheck.scan.ExclusionMatcher

public final class ExclusionMatcher extends Object
Decides whether a file or directory is excluded from a scan.

Three independent rules:

  • excludedFiles - exact match on the normalized relative path.
  • excludedDirs - directory-name match at any depth: a path is excluded when one of its path segments equals the entry, so build/ excludes both build/... and module/build/.... Also used by walkers to prune traversal.
  • excludedExtensions - case-insensitive match on the file extension (dot stripped).

All paths are normalized to '/' separators; directory entries keep no trailing slash; extension entries are lower-cased. null entries in the input sets are ignored.

  • Constructor Details

  • Method Details

    • none

      public static ExclusionMatcher none()
      A matcher that excludes nothing.
    • isExcludedFile

      public boolean isExcludedFile(String relPath)
      True if the file at the normalized relative path relPath must be skipped: exact file match, a directory-name match at any depth, or an excluded extension.
    • isExcludedDir

      public boolean isExcludedDir(String relPath)
      True if the directory at the normalized relative path relPath is named like an excluded directory (any path segment matches). Used by walkers to prune whole subtrees.
    • extensionOf

      public static String extensionOf(String relPath)
      Lower-cased file extension of a relative path, without the dot. Returns "" for files without an extension and for dot-files such as .gitignore.