Code Monkey home page Code Monkey logo

rulebook's Introduction

Rulebook - Simple Per-Project Linting

Make project-specific text rules using regular expressions.

Example

$ 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

To Use

  1. Make a Rulebook directory on Github.
  2. 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
  1. 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
  1. 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.
  2. Run rulebook diff to run the rulebook rules against your current git diff, or echo foo | rulebook validate to validate any arbirary text.

Pull Request Commenting

Rulebook can directly comment on Github Pull requests. To do this, simply run rulebook comment https://github.com/org/project/pull/pr_number.

rulebook's People

Contributors

oagr avatar

Stargazers

Jon Repp avatar  avatar Michael Hood avatar Robert Krzyzanowski avatar Peter Wildeford avatar Alex Bird avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.