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:
- Propose the change upstream in the core open source project (e.g.
rubocop
, orrubocop-rails
), where it will have maximal visibility and discussion/feedback. - Patch the change provisionally into GitHub's project(s), for immediate benefit; that can include this repository.
- ...if the proposal is accepted, remove the patch and pull the updated upstream.
- ...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
- Fork and clone the repository
- Build it and make sure the tests pass on your machine
- Create a new branch:
git checkout -b my-branch-name
- Make your change, add tests, and make sure the tests still pass
- Push to your fork and submit a Pull Request
- 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 intoconfig/default_pending.yml
andconfig/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 runbundle exec rake
to run the tests. -
Work through the pending cops, and copy them to
config/{default,rails}.yml
with an explicityEnabled: true
orEnabled: false
depending on your decision as to whether they should be part of our standard ruleset.
Releasing a new version
- Update
rubocop-github.gemspec
with the next version number - Update the
CHANGELOG
with changes and contributor - Run
bundle
to update gem version contained in the lockfile - Make a commit:
Release v{VERSION}
- Tag the commit :
git tag v{VERSION}
- Create the package:
gem build rubocop-github.gemspec
- Push to GitHub:
git push origin && git push origin --tags
- Push to Rubygems:
gem push rubocop-github-{VERSION}.gem
- Publish a new release on GitHub: https://github.com/github/rubocop-github/releases/new