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

[Rubocop] Remove line length limit for comments #25

Open
dvdgs88 opened this issue Nov 24, 2017 · 6 comments
Open

[Rubocop] Remove line length limit for comments #25

dvdgs88 opened this issue Nov 24, 2017 · 6 comments
Assignees

Comments

@dvdgs88
Copy link
Member

dvdgs88 commented Nov 24, 2017

Solution: https://stackoverflow.com/questions/26342570/rubocop-linelength-how-to-ignore-lines-with-comments

Why? Some usual initializers don't respect this rule and we need fix them to pass rubocop.

@dvdgs88 dvdgs88 changed the title [Rubocop] Remove line limit length for comments [Rubocop] Remove line length limit for comments Nov 24, 2017
@oriolbcn
Copy link
Contributor

Hmm not so sure about this. To me, one of the benefits of limiting line length is to have the file look more pretty on editors (by avoiding line wrapping and having all the text in the file more structured). For comments you can just put in into multiple lines, I don't see it as an issue.

@danigb
Copy link
Contributor

danigb commented Nov 24, 2017

No tengo una opinión clara... Me inclino por simplificar y no tener demasiadas excepciones a las reglas ("80 caracteres, menos los comentarios"). Por otro lado, no me he encontrado con ese problema que comentas @dvdgs88 de los initializers.

@xredo
Copy link
Member

xredo commented Nov 24, 2017

I think that the comments are still part of the code, so I don't really like to make exceptions based on this.

My suggestion is to ignore some of this initializers. For example, Devise or ActiveAdmin have initializers that don't comply with the rules from Rubocop. We can make a proposal to ignore all these init files from the Rubocop checks. They weren't written by us.

Regarding Rails application.rb, and environmnets/*.rb I think that with the Pathfinder we will have all the problems with styles solved.

@xredo xredo added the Ruby label Nov 24, 2017
@davidgg
Copy link
Member

davidgg commented Oct 20, 2018

any update on this? Where is the correct place to apply that ignore rule, is the rubocop file a suitable place?

@davidgg davidgg assigned davidgg and dvdgs88 and unassigned davidgg Oct 20, 2018
@oriolbcn
Copy link
Contributor

Personally I would not add any exception. With respect to generated initializers I think it's quite fast to adapt the comments length and it's only once per project, I don't think it takes more than 5 minutes.

Thoughts?

@swiknaba
Copy link

swiknaba commented Nov 27, 2023

There are also some great gems, such as https://github.com/ctran/annotate_models, that auto-generate comments that offend the line length. Would be great if we could just allow these in Rubocop, but for the rest of our own code, we want to enforce Rubocop.

Another use-case are long URLs that we put for reference in a comment. Right now, I either have to mess with some pattern matching in Rubocop, or ignore single files by adding a flag to the line (or ignore the entire file, which is not ideal).

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

No branches or pull requests

6 participants