rubocop-github/CONTRIBUTING.md

3.3 KiB

Contributing

We welcome your contributions to the project. Thank you!

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

What to contribute

This repository, rubocop-github, is part of a broader RuboCop ecosystem.

If the Cop you would like to propose is generally applicable outside of GitHub:

  1. Propose the change upstream in the core open source project (e.g. rubocop, or rubocop-rails), where it will have maximal visibility and discussion/feedback.
  2. Patch the change provisionally into GitHub's project(s), for immediate benefit; that can include this repository.
  3. ...if the proposal is accepted, remove the patch and pull the updated upstream.
  4. ...if the proposal is not accepted, we usually learn something about our proposal, and we then choose whether to maintain the patch ourselves, discard it, or identify a better open-source home for it.

If the Cop is only applicable for GitHub, then this is the right place to propose it.

How to contribute a Pull Request

  1. Fork and clone the repository
  2. Build it and make sure the tests pass on your machine
  3. Create a new branch: git checkout -b my-branch-name
  4. Make your change, add tests, and make sure the tests still pass
  5. Push to your fork and submit a Pull Request
  6. Pat yourself on the back and wait for your pull request to be reviewed and merged.

For Maintainers

Updating Rubocop Dependencies

Rubocop regularly releases new versions with new cops. We want to keep up to date with the latest Rubocop releases, and keep these rules and styleguide in sync to reduce burden on consumers of this gem.

  • Run bundle update rubocop rubocop-performance rubocop-rails to update the dependencies within this repository. Major updates will require updating the .gemspec file because of the pinned version constraints.

  • Run bundle exec rubocop, and copy the output of newly introduced rules into config/default_pending.yml and config/rails_pending.yml. They should look like this:

    Lint/DuplicateMagicComment: # new in 1.37
      Enabled: true
    Style/OperatorMethodCall: # new in 1.37
      Enabled: true
    Style/RedundantStringEscape: # new in 1.37
      Enabled: true
    
  • Run bundle exec rubocop again to ensure that it runs cleanly without any pending cops. Also run bundle exec rake to run the tests.

  • Work through the pending cops, and copy them to config/{default,rails}.yml with an explicity Enabled: true or Enabled: false depending on your decision as to whether they should be part of our standard ruleset.

Releasing a new version

  1. Update rubocop-github.gemspec with the next version number
  2. Update the CHANGELOG with changes and contributor
  3. Run bundle to update gem version contained in the lockfile
  4. Make a commit: Release v{VERSION}
  5. Tag the commit : git tag v{VERSION}
  6. Create the package: gem build rubocop-github.gemspec
  7. Push to GitHub: git push origin && git push origin --tags
  8. Push to Rubygems: gem push rubocop-github-{VERSION}.gem
  9. Publish a new release on GitHub: https://github.com/github/rubocop-github/releases/new