Skip to content
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 guidelines for how to use magic comments #616

Merged
merged 1 commit into from
Jan 10, 2017
Merged

Add guidelines for how to use magic comments #616

merged 1 commit into from
Jan 10, 2017

Conversation

backus
Copy link
Contributor

@backus backus commented Jan 8, 2017

See rubocop/rubocop#3285 for previous discussion about magic comments. See rubocop/rubocop#3879 if you are interested in the rules for magic comments with multiple instructions (a mostly undocumented ruby feature AFAICT).


* <a name="magic-comments-first"></a>
Place magic comments above all code and documentation. Magic comments should only go below shebangs if they are needed in your source file.
<sup>[[link](#magic-comments-first)]</sup>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add some code examples here as well.

@backus
Copy link
Contributor Author

backus commented Jan 9, 2017

@bbatsov updated with another example

@bbatsov bbatsov merged commit 8d88659 into rubocop:master Jan 10, 2017
@backus backus deleted the magic-comments branch January 10, 2017 18:19
backus added a commit to backus/rubocop that referenced this pull request Jan 24, 2017
bbatsov pushed a commit to rubocop/rubocop that referenced this pull request Jan 25, 2017
koic pushed a commit to rubocop/rubocop-rails that referenced this pull request Oct 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants