Make project-specific text rules using regular expressions.
$ echo "Make & use rules to avoid simple mistakes.\na = ! foobar; puts 'bar'\ndebugger;\n:not{}" | rulebook validate |
Make & use rules to avoid simple mistakes.
a = ! foobar; puts 'bar'
- Rulebook Violation -> {regex: !\s\w, message: Ruby: Space after !}
debugger;
- Rulebook Violation -> {regex: debugger, message: Remove debuggers before committing}
:not{}
- Rulebook Violation -> {regex: :not{}, message: IE8 Incompatible}
---------------------
3 Rulebook Violations
regex: !\s\w message: Ruby: Space after !
regex: debugger message: Remove debuggers before committing
regex: :not{} message: IE8 Incompatible
- Make a Rulebook directory on Github.
- Add .yaml files in it with rules. These should be styled as such:
rules:
- regex: ‘!\s\w’
warning: “Ruby: Space after !”
- group:
warning: not in ie8
regex:
##CSS3
- :@namespace
- :@keyframes
- :@-ms-viewport
- Create a
.rulebook
file in a project you would like to check. This should contain the name of the rulebook you created.
github.com/oagr/rulebook1
- On your machine, cd into the project with the .rulebook file. Run
rulebook book clone
to download it to the.rulebooks
directory on your machine. - Run
rulebook diff
to run the rulebook rules against your currentgit diff
, orecho foo | rulebook validate
to validate any arbirary text.
Rulebook can directly comment on Github Pull requests. To do this, simply run rulebook comment https://github.com/org/project/pull/pr_number
.