A Ruby static code analyzer, based on the community Ruby style guide.
Ruby Other
Latest commit c6dad32 Feb 21, 2017 @pocke pocke committed with Add parameters count to offense message for `Metrics/ParameterLists` cop
Most Metrics cops display `[%d/%d]`.
However, `Metrics/ParameterLists` and `Metrics/BlockNesting` don't display this.

For example:

```sh
$ rubocop --only Metrics -D
Inspecting 1 file
C

Offenses:

test.rb:1:1: C: Metrics/MethodLength: Method has too many lines. [12/10]
def foo(x, y, z, a, b, c, d, e) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test.rb:1:8: C: Metrics/ParameterLists: Avoid parameter lists longer than 5 parameters.
def foo(x, y, z, a, b, c, d, e)
       ^^^^^^^^^^^^^^^^^^^^^^^^
test.rb:5:9: C: Metrics/BlockNesting: Avoid more than 3 levels of block nesting.
        if cond4 ...
        ^^^^^^^^

1 file inspected, 3 offenses detected
```

I think those cops should display count/max.
However, `Metrics/BlockNesting` cop doesn't have the count value.
So, this change make to display the count only `Metrics/ParameterLists` cop.
Permalink
Failed to load latest commit information.
.github Uses Chris Beams's commit message guidelines Feb 4, 2017
assets [Fix #3379] Add a TOC at the beginning of HTML formatted output (#3472) Sep 5, 2016
bin Internally switch to `when_needed` encoding style Sep 29, 2016
config Add a new cop, Style/InverseMethods Feb 19, 2017
lib Add parameters count to offense message for `Metrics/ParameterLists` cop Feb 21, 2017
logo [Fix #578] Add a logo Sep 4, 2014
manual [Fix #3981] Allow NumericLiterals to be less strict Feb 21, 2017
relnotes Cut 0.47.1 Jan 18, 2017
spec Add parameters count to offense message for `Metrics/ParameterLists` cop Feb 21, 2017
tasks Apply `Style/IndentHeredoc` cop Feb 10, 2017
.editorconfig Add an `.editorconfig` file (#3748) Dec 1, 2016
.gitattributes Change merge driver for CHANGELOG.md to resolve conflict problem Oct 11, 2016
.gitignore Add TAGS to .gitignore Jun 2, 2014
.rspec Initial commit to rubocop. Apr 21, 2012
.rubocop.yml Apply `Style/IndentHeredoc` cop Feb 10, 2017
.rubocop_todo.yml Add `ResbodyNode` and `EnsureNode` node extension Feb 17, 2017
.travis.yml Fix jruby on travis Jan 24, 2017
.yardopts Hide void return of methods in YARD documentation Jun 10, 2013
CHANGELOG.md Add parameters count to offense message for `Metrics/ParameterLists` cop Feb 21, 2017
CONTRIBUTING.md Add an instruction to prefix commit message with issue number (#3236) Jun 21, 2016
Gemfile Bump the yard dep Dec 13, 2016
LICENSE.txt Bump license years for 2017 (#3843) Jan 1, 2017
README.md Fix sponsor/backer badge links in README Jan 30, 2017
Rakefile Add check on CI that manual files are in sync Nov 9, 2016
mkdocs.yml Add Automated Code Review section with info for tools like Codacy Dec 14, 2016
rubocop.gemspec Bump the parser dep Dec 13, 2016

README.md

Gem Version Dependency Status Build Status Coverage Status Code Climate Inline docs

Gratipay Team OpenCollective OpenCollective

RuboCop Logo

Role models are important.
-- Officer Alex J. Murphy / RoboCop

RuboCop is a Ruby static code analyzer. Out of the box it will enforce many of the guidelines outlined in the community Ruby Style Guide.

Most aspects of its behavior can be tweaked via various configuration options.

Apart from reporting problems in your code, RuboCop can also automatically fix some of the problems for you.

Gitter

Please consider supporting financially its ongoing development.

Installation

RuboCop's installation is pretty standard:

$ gem install rubocop

If you'd rather install RuboCop using bundler, don't require it in your Gemfile:

gem 'rubocop', require: false

RuboCop's development is moving at a very rapid pace and there are often backward-incompatible changes between minor releases (since we haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you might want to use a conservative version locking in your Gemfile:

gem 'rubocop', '~> 0.47.1', require: false

Quickstart

Just type rubocop in a Ruby project's folder and watch the magic happen.

$ cd my/cool/ruby/project
$ rubocop

Official manual

You can read a ton more about RuboCop in its official manual.

Compatibility

RuboCop supports the following Ruby implementations:

  • MRI 2.0
  • MRI 2.1
  • MRI 2.2
  • MRI 2.3
  • MRI 2.4
  • JRuby 9.0+
  • Rubinius 2.0+

Team

Here's a list of RuboCop's core developers:

Logo

RuboCop's logo was created by Dimiter Petrov. You can find the logo in various formats here.

The logo is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

Contributors

Here's a list of all the people who have contributed to the development of RuboCop.

I'm extremely grateful to each and every one of them!

If you'd like to contribute to RuboCop, please take the time to go through our short contribution guidelines.

Converting more of the Ruby Style Guide into RuboCop cops is our top priority right now. Writing a new cop is a great way to dive into RuboCop!

Of course, bug reports and suggestions for improvements are always welcome. GitHub pull requests are even better! :-)

Funding

While RuboCop is free software and will always be, the project would benefit immensely from some funding. Raising a monthly budget of a couple of thousand dollars would make it possible to pay people to work on certain complex features, fund other development related stuff (e.g. hardware, conference trips) and so on. Raising a monthly budget of over $5000 would open the possibility of someone working full-time on the project which would speed up the pace of development significantly.

We welcome both individual and corporate sponsors! We also offer a wide array of funding channels to account for your preferences (although currently Open Collective is our preferred funding platform).

If you're working in a company that's making significant use of RuboCop we'd appreciate it if you suggest to your company to become a RuboCop sponsor.

You can support the development of RuboCop via Salt, Gratipay and Open Collective.

Support via Gratipay

Open Collective Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Open Collective Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

Changelog

RuboCop's changelog is available here.

Copyright

Copyright (c) 2012-2017 Bozhidar Batsov. See LICENSE.txt for further details.