Have you ever wanted to lint your open source repository for common issues at build time... such as a missing LICENSE, SECURITY.md CONTRIBUTING.md or even absent source license headers? There is a tool built by the TODO Group called repolinter that tackles this problem:
todogroup / repolinter
Repolinter, The Open Source Repository Linter
Lint open source repositories for common issues.
Installation
Repolinter requires Node.JS >= v12 to function properly. Once Node.JS is installed, you can install Repolinter using npm
:
npm install -g repolinter
Linting a Local Repository
Once installed, run the following to lint a directory:
repolinter lint <directory>
The above command will lint <directory>
with the local repolinter.json
ruleset or the default ruleset if none is found:
repolinter % repolinter lint .
Target directory: <directory>
Lint:
✔ license-file-exists: Found file (LICENSE)
✔ readme-file-exists: Found file (README.md)
✔ contributing-file-exists: Found file (CONTRIBUTING)
✔ code-of-conduct-file-exists: Found file (CODE-OF-CONDUCT)
✔ changelog-file-exists: Found file (CHANGELOG)
...
repolinter % echo $?
0
Linting a Remote Repository
Repolinter also supports linting a git repository using the --git
flag. With this flag enabled, the directory input will be interpreted as a git URL which Repolinter will automatically clone into a temporary directory.
repolinter lint -g https://github.com/todogroup/repolinter.git
It's as simple as running 'npx repolinter' against a repository:
You can decide what rules to run against your repository:
You can also build custom rules for your project, for example, this pull request added a rule to check for security policies (SECURITY.md):
Add check for security policies #146
https://help.github.com/en/articles/adding-a-security-policy-to-your-repository
Signed-off-by: Chris Aniszczyk caniszczyk@gmail.com
If you have ideas for more rules, please contribute them to the project.
Anyways, happy open source linting!
Top comments (0)