-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 Style/EmptyLineAfterMagicComment cop #3889
Add Style/EmptyLineAfterMagicComment cop #3889
Conversation
4f08fed
to
b6d72e9
Compare
Looks like this touches more tests than I thought. Work in progress.... |
end | ||
|
||
it 'accepts code that separates the comment from the code with a newline' do | ||
inspect_source(cop, ["# frozen_string_literal: true\n", |
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.
What are your thoughts on writing this as
inspect_source(cop, ["# frozen_string_literal: true",
'',
'class Foo; end'])
In my mind, it is a little clearer that there is an empty line between the comment and the class.
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.
Yeah I'm fine with either just didn't know what was the convention
Should this be configurable so that the user can choose whether they want to enforce having an empty line or not having an empty line? I don't think that I saw a test that includes a magic comment and documentation comment. Should the following code register an offense? # frozen_string_literal: true
# Class documentation
class Foo
end |
IMHO, it should. To me, the lack of spacing would indicate that both comment lines pertain to |
b6d72e9
to
02b7f47
Compare
Yeah good catch guys I also need to add a test case for separating the frozen_string_literal comment from the class documentation |
6195698
to
06c977d
Compare
06c977d
to
96fd191
Compare
@bbatsov build is passing finally minus this weird jruby bug that is plaguing every build. |
@Drenmi and @rrosenblum I think I addressed your concerns |
96fd191
to
3f36f24
Compare
3f36f24
to
e17fecf
Compare
The errors were being triggered by the following new cops: - rubocop/rubocop#4133 - rubocop/rubocop#3889 - rubocop/rubocop#4028
Depends on rubocop/ruby-style-guide#616
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
rake generate_cops_documentation
(required only when you've added a new cop or changed the configuration/documentation of an existing cop).