auditor — cross platform CLI file system linter and auditor
auditor rulebook.yml [-t|--target directory...] [-e|--exclude pattern...] [-j|--jobs num] [-o|--out file] [-v|--verbose|-q|--quiet]
auditor --checks [-v|--verbose|-q|--quiet]
auditor [--help|--version]
Audits and lints files and directories, validating them against checks according to a YAML rulebook.
-
rulebook.yml
The name of a YAML format file to run as a rulebook.
-
-t directory..., --target directory...
The path to one or more directories to run the checks from.
Takes priority over directories value from the rulebook if specified.
Targets can be provided via standard input, one path per line.
-
-e pattern..., --exclude pattern...
One or more patterns to exclude from targeting.
Takes priority over exclude value from the rulebook if specified.
-
-j num, --jobs num
Number of jobs to run simultaneously, defaults to system CPU thread count.
A value of 1 will guarantee checks run in a consistent order.
-
-o file, --out file
File to write check results to.
-
--checks
Prints available check information and exits.
-
-v, --verbose
Enable verbose output.
Takes priority over
--quiet
. -
-q, --quiet
Enable quiet output.
-
--help
Prints brief usage information and exits.
-
--version
Prints the current version number and exits.
auditor rules.yml
auditor rules.yml --target D:\Documents E:\
echo D:\ | auditor rules.yml
auditor rules.yml --exclude "**/*.txt"
Checks target either a file or a directory, perform an action and return success or failure according to the requirements.
Checks are loaded and resolved at runtime from any compatible .dll
file found in the Checks/
directory relative to the application binary.
Auditor uses YAML rulebook files to define check rules. A rulebook is consists of the following basic properties:
directory:
# Windows
- 'D:\'
- '%USERPROFILE$\Documents'
- '\\server\share\Files\'
# Linux/MacOS
- '/mnt/docs/'
- 'files/'
- '~/documents'
exclude: '*.txt'
rules:
...
Paths can be absolute or relative to the working directory, in any format the operating system supports.
If directories are specified at runtime, the rulebook value is ignored.
Paths can be absolute or relative to the working directory, in any format the operating system supports.
If directories are specified at runtime, the rulebook value is ignored.
List of check rules to run.
rules:
- name: Images are below 1MB in size
target:
- '**\*.+(jpg|png|bmp)' # Any .jpg .png or .bmp files anywhere under the target
- '!**\folder.jpg' # Exclude any folder.jpg files
auditor.checks.file.size:
max: 1mb
The display name of this check instance
Should be a descriptive name summarising the characteristics this check is verifying.
The name of the check to run, corresponding to the available check plugins at runtime.
See --checks
to print a list of available checks.
Corresponds to the full type name of the check as lowercase.
A check property can be any name and require a value of any type, as defined by the selected check. See the individual check documentation for its options.
Auditor uses Minimatch patterns to include or exclude targets with some extra features.
**\*.+(jpg|png|bmp)
A pattern is a negative match if it starts with an !
.
!**\ # Exclude all directories
!file-{1..5}.txt # Exclude a range of files
!image.jpg # Exclude a single file
A pattern can have extra flags attached to it by ending with a ?
followed by flag symbols.
-
i
Make the pattern match case insensitive.
*.jpg?i
-
r
Parse the pattern as a regular expression rather than with Minimatch.
^\w+\.txt$?r \.txt$?ri # Case insensitive regex
Auditor.Checks.Directory.Exists
Auditor.Checks.Directory.Empty
Auditor.Checks.Directory.Contains
Auditor.Checks.Directory.MaxExtensions
Auditor.Checks.File.Empty
Auditor.Checks.File.Matches
Auditor.Checks.File.Size
Auditor.Checks.Audio.Bitrate
Auditor.Checks.Audio.Channels
Auditor.Checks.Audio.SampleRate
Auditor.Checks.Audio.TagFileCount
Auditor.Checks.Audio.TagMatches
Auditor.Checks.Audio.TagsMatch
Auditor.Checks.Audio.Path
Auditor.Checks.Audio.MpegVbr
Auditor.Checks.Audio.Frames
Auditor.Checks.Audio.Image
Auditor.Checks.Audio.ImageCount
Auditor.Checks.Audio.EmbeddedArtExtracted
Auditor.Checks.Image.AspectRatio
Auditor.Checks.Image.Resolution
Auditor.Checks.Image.FileInterlace
Auditor.Checks.Image.FileFormat
Auditor.Checks.Image.FileCompression
Auditor.Checks.Image.FileColorspace
Auditor.Checks.Video.Streams
Auditor.Checks.Video.AudioStreams
Auditor.Checks.Video.VideoStreams
Auditor.Checks.Video.VideoFormat