New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a task to generate a new cop #517

Merged
merged 1 commit into from Jan 5, 2018

Conversation

Projects
None yet
3 participants
@pocke
Member

pocke commented Dec 25, 2017

NOTE: This pull-request needs an upstream's pull-request. rubocop-hq/rubocop#5270 It's merged!

This pull-request will add a task to generate a new cop template.

$ bundle exec rake new_cop[RSpec/Foo]
[create] lib/rubocop/cop/rspec/foo.rb
[create] spec/rubocop/cop/rspec/foo_spec.rb
[modify] lib/rubocop/cop/rspec_cops.rb - `require_relative 'rspec/foo'` was injected.
[modify] A configuration for the cop is added into config/default.yml.
         If you want to disable the cop by default, move the added config to config/disabled.yml
Do 3 steps:
  1. Add an entry to the "New features" section in CHANGELOG.md,
     e.g. "Add new `RSpec/Foo` cop. ([@your_id][])"
  2. Modify the description of RSpec/Foo in config/enabled.yml
  3. Implement your new cop in the generated file!

I believe the task is very useful when we create a new cop.

And this pull-request will change lib/rubocop-rspec.rb to enable to work injection require_relative statement.
The injection does not work without this change.


Before submitting the PR make sure the following are checked:

  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes.
  • The build (bundle exec rake) is passing.

@pocke pocke referenced this pull request Dec 25, 2017

Merged

Make the cop generator to work on rubocop-rspec #5270

6 of 8 tasks complete
@pocke

This comment has been minimized.

Show comment
Hide comment
@pocke

pocke Jan 5, 2018

Member

Hi.
The upstream pull-request is merged, and released as v0.52.1. So I think this pull-request is ready.
Can you review it?

Member

pocke commented Jan 5, 2018

Hi.
The upstream pull-request is merged, and released as v0.52.1. So I think this pull-request is ready.
Can you review it?

@Darhazer

Look good to me

@Darhazer Darhazer requested a review from bquorning Jan 5, 2018

@bquorning

Thank you.

@bquorning bquorning merged commit d79e910 into rubocop-hq:master Jan 5, 2018

13 checks passed

buildkite/rubocop-rspec Build #991 passed (25 seconds)
Details
buildkite/rubocop-rspec/pipeline Passed (1 second)
Details
buildkite/rubocop-rspec/rspec-rspec-2-dot-1 Passed (10 seconds)
Details
buildkite/rubocop-rspec/rspec-rspec-2-dot-2 Passed (11 seconds)
Details
buildkite/rubocop-rspec/rspec-rspec-2-dot-3 Passed (10 seconds)
Details
buildkite/rubocop-rspec/rspec-rspec-2-dot-4 Passed (11 seconds)
Details
buildkite/rubocop-rspec/rubocop-rubocop-2-dot-1 Passed (15 seconds)
Details
buildkite/rubocop-rspec/rubocop-rubocop-2-dot-2 Passed (15 seconds)
Details
buildkite/rubocop-rspec/rubocop-rubocop-2-dot-3 Passed (15 seconds)
Details
buildkite/rubocop-rspec/rubocop-rubocop-2-dot-4 Passed (15 seconds)
Details
buildkite/rubocop-rspec/scroll-configuration Passed (10 seconds)
Details
buildkite/rubocop-rspec/verify-build-unchanged Passed (2 seconds)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@pocke pocke deleted the pocke:new_cop branch Jan 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment