Rules

April 26, 2024 ยท View on GitHub

Below is a complete list of rules that Repolinter can run, along with their configuration options.

Contents

Reference

apache-notice

No inputs. Checks for the presense of a NOTICE file in the root of the repository. This rule is equivalent to the following:

{
  "type": "file-existence",
  "options": {"globsAny": ["NOTICE*"]}
}

directory-existence

Checks the existence of a given directory.

InputRequiredTypeDefaultDescription
globsAnyYesstring[]A list of globs to search for. This rule passes if at least one glob returns a directory.
nocaseNobooleanfalseSet to true to perform a case insensitive search.
fail-messageNostring""The string to print if the directory does not exist, used to create human-readable error messages.

file-contents

Checks if the contents of a file match a given regular expression.

InputRequiredTypeDefaultDescription
globsAllYesstring[]A list of globs to get files for. This rule passes if all of the files returned by the globs match the supplied string, or if no files are returned.
contentYesstringThe regular expression to check using String#search. This expression should not include the enclosing slashes and may need to be escaped to properly integrate with the JSON config (ex. ".+@.+\\..+" for an email address).
nocaseNobooleanfalseSet to true to make the globs case insensitive. This does not effect the case sensitivity of the regular expression.
flagsNostring""The flags to use for the regular expression in content (ex. "i" for case insensitivity).
human-readable-contentNostringThe regular expression in contentThe string to print instead of the regular expression when generating human-readable output.
fail-on-non-existentNobooleanfalseSet to true to disable passing if no files are found from globsAll.

file-existence

Checks the existence of a given file.

InputRequiredTypeDefaultDescription
globsAnyYesstring[]A list of globs to search for. This rule passes if at least one glob returns a file.
nocaseNobooleanfalseSet to true to perform a case insensitive search.
dirsNobooleanfalseSet to true to include directories in the search (equivalent to directory-exists)
fail-messageNostring""The string to print if the directory does not exist, used to create human-readable error messages.

file-hash

Checks that a given file matches a provided hash.

InputRequiredTypeDefaultDescription
globsAnyYesstring[]A list of globs to search for. This rule passes if at least one file found matches the provided hash, and fails if no files are found.
hashYesstringThe hash to check against. Unless a different algorithm is specified, this will be sha256 hash.
algorithmNostringsha256The hash algorithm to use. Repolinter supports any algorithm supported by crypto.createHash
nocaseNobooleanfalseSet to true to perform a case insensitive search.
succeed-on-non-existentNobooleanfalseSet to true to enable passing if no files are found from globsAll.

file-hashes-not-exist

Check files' hashes not included in a list of certain cryptographic hashes.

InputRequiredTypeDefaultDescription
globsAllYesstring[]A list of globs to search for. This rule passes if all the files does not match any of the hashes, or no files are found.
hashesYesstring[]The hashes to check against. Unless a different algorithm is specified, this will be sha256 hash.
algorithmNostringsha256The hash algorithm to use. Repolinter supports any algorithm supported by crypto.createHash
nocaseNobooleanfalseSet to true to perform a case insensitive search.

Scans a set of markup files for broken links. Links are tested by first rendering the markup file to HTML using github-markup, then each <a> tag in the HTML is extracted and tested using broken-link-checker--as a result, this rule only supports checking markup formats supported by github-markup. Absolute URLs are checked using a HTTP request, and relative URLs are checked by accessing the file specified.

github-markup and its dependencies must be installed and available in PATH to use this rule.

InputRequiredTypeDefaultDescription
globsAllYesstring[]A list of globs to search for. This rule passes if all of the markup files found do not contain broken links.
nocaseNobooleanfalseSet to true to perform a case insensitive search.
succeed-on-non-existentNobooleanfalseSet to true to enable passing if no files are found from globsAll.
pass-external-relative-linksNobooleanfalseSet to true to allow relative URLs outside of the target directory. As there is no good way to check these URLs, they will automatically pass if this setting is true.

file-not-contents

Checks none of a given list of files match a given regular expression.

Note: provide either content or contents

InputRequiredTypeDefaultDescription
globsAllYesstring[]A list of globs to get files for. This rule passes if none of the files returned by the globs match the supplied string, or if no files are returned.
contentYes if contents is undefinedstringThe regular expression to check using String#search. This expression should not include the enclosing slashes and may need to be escaped to properly integrate with the JSON config (ex. ".+@.+\\..+" for an email address).
contentsYes if content is undefinedstring[]Regular expressions to check using String#search. This expression should not include the enclosing slashes and may need to be escaped to properly integrate with the JSON config (ex. ".+@.+\\..+" for an email address).
nocaseNobooleanfalseSet to true to make the globs case insensitive. This does not effect the case sensitivity of the regular expression.
flagsNostring""The flags to use for the regular expression in content (ex. "i" for case insensitivity).
human-readable-contentNostringThe regular expression in contentThe string to print instead of the regular expression when generating human-readable output.
fail-on-non-existentNobooleanfalseSet to true to disable passing if no files are found from globsAll.

file-not-exists

Checks that a file doesn't exist.

InputRequiredTypeDefaultDescription
globsAllYesstring[]A list of globs to search for. This rule fails if at least one glob returns a file.
nocaseNobooleanfalseSet to true to perform a case insensitive search.
dirsNobooleanfalseSet to true to include directories in the search.
pass-messageNostring""The string to print if the file does not exist, used to create human-readable error messages.

file-starts-with

Checks that the first lines of a file contain a set of regular expressions.

InputRequiredTypeDefaultDescription
globsAllYesstring[]A list of globs to search for. This rule passes if the starting contents of all found files match all patterns, and fails if no files are found.
lineCountYesnumberThe number of lines to scan into for each file.
patternsYesstring[]The regular expressions to check using String#search. These expressions should not include the enclosing slashes and may need to be escaped to properly integrate with the JSON config (ex. ".+@.+\\..+" for an email address).
flagsNostring""The flags to use for the regular expressions in patterns (ex. "i" for case insensitivity).
nocaseNobooleanfalseSet to true to perform a case insensitive search on the files. This will not effect the case sensitivity of patterns.
succeed-on-non-existentNobooleanfalseSet to true to enable passing if no files are found from globsAll.
skip-binary-filesNobooleanfalseSet to true to exclude binary files from globsAll.
skip-paths-matchingNo{ extensions?: string[], patterns?: string[], flags?: string }{}Use this option to exclude paths from globsAll, either by file extension or by regular expression.

file-type-exclusion

Checks that no files exist of a certain filetype.

InputRequiredTypeDefaultDescription
typeYesstring[]A list of globs to search for. This rule passes if no files are found.

git-grep-commits

Searches Git commits for configurable blacklisted words. These checks can be a bit time consuming, depending on the size of the Git history.

InputRequiredTypeDefaultDescription
denylistYesstring[]A list of patterns to search for.
ignoreCaseNobooleanfalseSet to true to make denylist case insensitive.

git-grep-log

Searches Git commit messages for configurable blacklisted words. These checks can be a bit time consuming, depending on the size of the Git history.

InputRequiredTypeDefaultDescription
denylistYesstring[]A list of patterns to search for.
ignoreCaseNobooleanfalseSet to true to make denylist case insensitive.

git-list-tree

Check for blacklisted filepaths in Git.

InputRequiredTypeDefaultDescription
denylistYesstring[]A list of patterns to search against all paths in the git history.
ignoreCaseNobooleanfalseSet to true to make denylist case insensitive.

git-working-tree

Checks whether the directory is managed with Git.

InputRequiredTypeDefaultDescription
allowSubDirNobooleanWhether or not to search subdirectories for a git repository.

large-file

Check if a list of files' size on the file system that is larger than provided size.

InputRequiredTypeDefaultDescription
globsAllYesstring[]A list of globs to get files for. This rule passes if all of the files returned by the globs match are smaller than size or if no files are returned.
sizeYesnumberfiles sizes larger than this number (bytes) will fail this rule.

json-schema-passes

Checks if a given file matches a provided JSON schema. This check is performed using AJV.

InputRequiredTypeDefaultDescription
globYesstringThe file to check a schema against. If more than one file is found, the first match will be checked.
schemaYesJSON SchemaThe JSON schema to validate against, as a JSON object.
nocaseNobooleanfalseSet to true to perform a case insensitive search.
human-readable-messageNostringThe schema in schemaThe string to print instead of the schema when generating human-readable output.
succeed-on-non-existentNobooleanfalseSet to true to enable passing if no files are found from glob.

license-detectable-by-licensee

Fails if Licensee doesn't detect the repository's license. This rule takes no inputs, but requires licensee in the path, see command line dependencies for details.

best-practices-badge-present

Check Best Practices Badge is present in README. Optionally check a certain badge level is accomplished.

InputRequiredTypeDefaultDescription
minPercentageNointegernullMinimum Tiered Percentage accomplished by project. passing=100, silver=200, gold=300, set to 0 or null to disable check.