What is Rubocop?
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.
Why do we need it?
We’ve started to notice a divergent in the coding styles used across our Ruby files as our code base continues to grow and new inconsistencies are constantly being introduced. Without using a linter, it is hard for us to maintain and communicate the coding style that the Discourse team would like to follow. With Rubocop, the coding style is being policed automatically by these set of rules defined in .rubocop.yml.
How do I run it?
In the root directory of your Discourse folder, simply run
bundle exec rubocop
bundle exec rubocop --parallel
for faster execution.
Integrations with your code editor
- GitHub - pderichs/sublime_rubocop: A Sublime Text RuboCop plugin.
- GitHub - SublimeLinter/SublimeLinter-rubocop: SublimeLinter 3 plugin for Ruby, using rubocop.