Skip to content

Bugcrowd-specific Rubocop cops

License

Notifications You must be signed in to change notification settings

bugcrowd/rubocop-bugcrowd

Repository files navigation

Rubocop::Bugcrowd

Rubocop custom extension for rules specific to Bugcrowd's projects. Custom extension lets us share between projects and more easily test the cops in isolation. Many of these cops are not universally applicable to Rails/Ruby projects, they are simply a way of deprecating/prefering certain patterns as teams and projects grow in the Bugcrowd organization.

To experiment, run bin/console for an interactive prompt.

Installation

Add this line to your application's Gemfile:

gem 'rubocop-bugcrowd', require: false

and require it at the top of your .rubocop.yml

require:
  - rubocop-bugcrowd

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bundle exec rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

Checkout the Rubocop docs for node pattern matching https://docs.rubocop.org/rubocop-ast/node_pattern.html. You can also use this handle tool for quickly pasting in sample code to see how the Ruby parser reads it https://nodepattern.herokuapp.com/

Generating a new cop

bundle exec rake 'new_cop[Bugcrowd/UseThisInsteadOfThat]'

The Rubocop documentation is decent (but getting better) for writing a new cop. All cops should exhaustively tested -- a poorly implemented cop can be very frustrating for devs.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Rubocop::Bugcrowd project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Contributors ✨

Thanks goes to these contributors past/present/future: