All Projects → volmer → Policial

volmer / Policial

Licence: mit
Review pull requests for style guide violations

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Policial

minitest-style-guide
Best practices for writing your tests
Stars: ✭ 42 (+16.67%)
Mutual labels:  rubocop, style-guide
Reviewdog
🐶 Automated code review tool integrated with any code analysis tools regardless of programming language
Stars: ✭ 4,541 (+12513.89%)
Mutual labels:  linter, code-review
Lint Review
An automated code linting bot that integrates various code lint tools with github pull requests.
Stars: ✭ 279 (+675%)
Mutual labels:  linter, rubocop
jetrockets-standard
Standard RuboCop configuration for JetRockets with cookies
Stars: ✭ 14 (-61.11%)
Mutual labels:  rubocop, linter
Eslint Config Standard React
ESLint Shareable Config for React/JSX support in JavaScript Standard Style
Stars: ✭ 416 (+1055.56%)
Mutual labels:  linter, style-guide
ue5-style-guide
An attempt to make Unreal Engine 4 projects more consistent
Stars: ✭ 2,892 (+7933.33%)
Mutual labels:  style-guide, linter
Awesome Standard
Documenting the explosion of packages in the standard ecosystem!
Stars: ✭ 300 (+733.33%)
Mutual labels:  linter, style-guide
rubocop-graphql
Rubocop extension for enforcing graphql-ruby best practices
Stars: ✭ 143 (+297.22%)
Mutual labels:  rubocop, linter
Ruby Style Guide
📘 Russian Version: A community-driven Ruby coding style guide.
Stars: ✭ 358 (+894.44%)
Mutual labels:  rubocop, style-guide
Git Cop
DEPRECATED: Use Git Lint (https://www.alchemists.io/projects/git-lint) instead.
Stars: ✭ 352 (+877.78%)
Mutual labels:  linter, style-guide
action-rubocop
Run rubocop with reviewdog 🐶
Stars: ✭ 83 (+130.56%)
Mutual labels:  rubocop, linter
Standard
🌟 JavaScript Style Guide, with linter & automatic code fixer
Stars: ✭ 26,433 (+73325%)
Mutual labels:  linter, style-guide
rubocop-linter-action
Rubocop Linter Action: A GitHub Action to run Rubocop against your code!
Stars: ✭ 86 (+138.89%)
Mutual labels:  rubocop, linter
standard-packages
List of packages that use `standard`
Stars: ✭ 32 (-11.11%)
Mutual labels:  style-guide, linter
standard-www
👆 Website for JavaScript Standard Style (@standard)
Stars: ✭ 28 (-22.22%)
Mutual labels:  style-guide, linter
Ruby Style Guide
A community-driven Ruby coding style guide
Stars: ✭ 15,836 (+43888.89%)
Mutual labels:  rubocop, style-guide
Eslint Config Standard
ESLint Config for JavaScript Standard Style
Stars: ✭ 2,229 (+6091.67%)
Mutual labels:  linter, style-guide
vscode-linter
Extension for code linting, all in one package. New linters can be easily added through an extension framework.
Stars: ✭ 47 (+30.56%)
Mutual labels:  rubocop, linter
Rubocop Performance
An extension of RuboCop focused on code performance checks.
Stars: ✭ 340 (+844.44%)
Mutual labels:  linter, rubocop
Rubocop Rails
A RuboCop extension focused on enforcing Rails best practices and coding conventions.
Stars: ✭ 433 (+1102.78%)
Mutual labels:  linter, rubocop

Policial 👮

Gem Version Build Status

Policial is a gem that investigates pull requests and accuses style guide violations. It is based on thoughtbot's Hound project. It currently supports RuboCop, SCSS and CoffeeLint.

Installation

Add this line to your application's Gemfile:

gem 'policial'

And then execute:

$ bundle

Or install it yourself as:

$ gem install policial

Usage

  1. First, instantiate a new Detective:
detective = Policial::Detective.new

You might need to pass an Octokit client with your GitHub credentials. For more information on this please check the Octokit README.

octokit = Octokit::Client.new(access_token: 'mygithubtoken666')
detective = Policial::Detective.new(octokit)

If you don't pass an Octokit client Policial will use the global Octokit configuration.

  1. Let's investigate! Start by briefing your detective about the pull request it will run an investigation against. You can setup a pull request manually:
detective.brief(
  repo: 'volmer/my_repo',
  number: 3,
  head_sha: 'headsha'
)

N. B. It's important to configure auto pagination for your client to receive reliable results on PRs with lot of files.

Or you can brief it with a GitHub pull_request webhook:

event = Policial::PullRequestEvent.new(webhook_payload)
detective.brief(event)
  1. Now you can run the investigation using the linters you want:
# Let's investigate this pull request and get a list of violations:
result = detective.investigate(linters: [Policial::Linters::RuboCop.new])
result.violations
# => [#<Policial::Violation:0x007ff0b5abad30 @filename="lib/test.rb", @line_number=1, ...>]

result.violations.first.message
"Prefer single-quoted strings when you don't need string interpolation or special symbols."

RuboCop

You can setup your RuboCop code style rules with a .rubocop.yml file in your repo. Please see RuboCop's README.

CoffeeLint

You can setup your CoffeeLint code style rules with a coffeelint.json file in your repo. For more information on how customize the linter rules please visit the Coffeelint website.

SCSS

SCSS linting is disabled by default. To enable it, you need to install the SCSS-Lint gem:

gem install scss_lint

Or add the following to your Gemfile and run bundle install:

gem 'scss_lint', require: false

The require: false is necessary because scss-lint monkey patches Sass. More info here.

Now you can use the SCSSLint linter when calling Detective#investigate:

violations = detective.investigate(linters: [Policial::Linters::SCSSLint.new])

You can setup your SCSS code style rules with a .scss-lint.yml file in your repo. For more information on how customize the linter rules please read SCSS-Lint's README.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].