Danger plugin for Rubocop
Switch branches/tags
Nothing to show
Clone or download
Latest commit 3959cca Nov 21, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Version bump. Nov 21, 2018
spec Add tests for fail_on_inline_comment option Nov 21, 2018
.gitignore Initial commit Jul 4, 2016
Gemfile [Gemfile] Allow any ruby 2+ version Jul 11, 2016
Gemfile.lock Fixes vulnerabilities. Dec 23, 2017
Guardfile Fix RuboCop Violations Jul 11, 2016
LICENSE Initial commit Jul 4, 2016
README.md Add :fail_on_inline_comment option Nov 21, 2018
Rakefile Fix RuboCop Violations Jul 11, 2016
circle.yml Adds circle ci config. Jul 16, 2016
danger-rubocop.gemspec Gemspec fix. May 19, 2017

README.md

CircleCI

Danger Rubocop

A Danger plugin for Rubocop.

Installation

Add this line to your Gemfile:

gem 'danger-rubocop'

Usage

Run Ruby files through Rubocop. Results are passed out as a table in markdown.

Specifying custom config file.

rubocop.lint

Lint specific files in a folder, when they change

public_files = (git.modified_files + git.added_files).select { |path| path.include?("/public/") }
rubocop.lint public_files

Methods

lint(config: Hash)

Runs Ruby files through Rubocop. Generates a markdown list of warnings.

This method accepts configuration hash. The following keys are supported:

  • files: array of file names or glob patterns to determine files to lint
  • force_exclusion: pass true to pass --force-exclusion argument to Rubocop. (this option will instruct rubocop to ignore the files that your rubocop config ignores, despite the plugin providing the list of files explicitely)
  • inline_comment: pass true to comment inline of the diffs.
  • fail_on_inline_comment: pass true to use fail instead of warn on inline comment.
  • report_danger: pass true to report errors to Danger, and break CI.

Passing files as only argument is also supported for backward compatibility.

License

MIT