0.01
No release in over a year
Shared Rubocop configuration for Search.gov repositories
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 13.0
~> 2.2

Runtime

 Project Readme

searchgov_style

Shared Rubocop configuration for Search.gov repositories

Installation

Add this line to your application's Gemfile:

group :test, :development do
  gem 'searchgov_style'
end

And then execute:

$ bundle

Or install it yourself as:

$ gem install searchgov_style

In the root directory of the repo using this gem, create a .rubocop.yml with the following directives:

For repositories that use Code Climate:

Refer to the work around for Code Climate's inability to use Rubocop's inherit_gem directive.

inherit_from:
  - https://raw.githubusercontent.com/GSA/searchgov_style/main/.default.yml

For repositories that do not use Code Climate:

inherit_gem:
  searchgov_style:
    - .default.yml
  • Generate a .rubocop_todo.yml:

      rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 2000
    
  • Add the following entry to .gitignore:

      .rubocop*default-yml
    

Usage

Run:

$ bundle exec rubocop

You do not need to include rubocop directly in your application's dependencies. searchgov_style will include specific versions of rubocop and related gems (such as rubocop-rspec) that are shared across all projects.

Refer to the Rubocop documentation for Rubocop usage instructions.

Development

Install the development gems:

$ bundle

Run Rubocop on the gem repository itself:

$ rubocop

Upgrading Rubocop

To upgrade the version of Rubocop used by this gem, perform the following steps to ensure compatibility with CodeClimate:

  1. Verify that the new version is supported by CodeClimate:
    list of Rubocop channels for CodeClimate
  2. Verify that the new version is listed as a channel for the Rubocop engine for the CodeClimate CLI:
    CodeClimate Engines
  3. Bump the version of Rubocop in the gemspec
  4. Bump the Rubocop channel in .codeclimate.yml

Verify your configuration and compatibility locally using the CodeClimate CLI:

$ bundle update
$ codeclimate validate-config
$ codeclimate analyze lib/ -e rubocop

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/searchgov_style.

License

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