-
-
Notifications
You must be signed in to change notification settings - Fork 277
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
Rename Cop to Base #962
Rename Cop to Base #962
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
This should not cause any user-observable changes, unless someone has their own custom cops inheriting from our base class.
RuboCop kept Cop
with a deprecation notice that Base
should be used instead.
Maybe we should, too?
Should I add an entry to the changelog?
Yes, it's a notable change for those having custom cops.
b92328a
to
20eeeac
Compare
I think the RuboCop It’s quite easy for implementors to add an alias from I’ve added a notice in the changelog. |
What I mean is that I suggest keeping |
20eeeac
to
069b825
Compare
@pirj I’ve added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
069b825
to
7899a82
Compare
end | ||
end | ||
# @deprecated Use ::RuboCop::Cop::RSpec::Base instead | ||
Cop = Base |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it produce some deprecation warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how to do that. An initializer hook? E.g.
def initialize(*)
warn '`::RuboCop::Cop::RSpec::Cop` is deprecate. Please use `::RuboCop::Cop::RSpec::Base` instead.'
super
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's really necessary.
If you feel it is, the following will do (just in case not to rely on super
):
class Cop < Base
def self.inherited(base)
warn '`::RuboCop::Cop::RSpec::Cop` is deprecated. Please use `::RuboCop::Cop::RSpec::Base` instead.'
end
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking the other day what is the best way to track things that we'd like to drop/improve in a major version when RuboCop is 2.0, a separate ticket, a project, a 2.0
tag, a code annotation.
Anything would do I suppose. Do you have any preference?
I only have this deprecation and those two pulls in mind #940 (cop retired). Is there anything I'm missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a separate ticket and a 2.0
milestone (to tag issues/PRs) would do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's time for rubocop-rubocop, containing cops on how to properly write cops, that could be used by extension developers :) Internal investigations brought to the next level ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reminds me of a style-guide-style-guide :D
@Darhazer please merge if you feel this is complete. |
This change is just so we follow the new naming pattern of RuboCop, who recently changd from `RuboCop::Cop::Cop` to `RuboCop::Cop::Base`. Here, we change `RuboCop::Cop::RSpec::Cop` to `RuboCop::Cop::RSpec::Base`. To make the commits easier to review, the superclass of all existing cops will be changed in a separate commit.
7899a82
to
d3a3d9c
Compare
This change is just so we follow the new naming pattern of RuboCop, which recently changed from
RuboCop::Cop::Cop
toRuboCop::Cop::Base
. Here, we changeRuboCop::Cop::RSpec::Cop
toRuboCop::Cop::RSpec::Base
.This should not cause any user-observable changes, unless someone has their own custom cops inheriting from our base class. Should I add an entry to the changelog?
Would you prefer that I squash the two commits?
Before submitting the PR make sure the following are checked:
master
(if not - rebase it).CHANGELOG.md
if the new code introduces user-observable changes.bundle exec rake
) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).