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

Limit annotation line length to 80 characters #192

Closed
ressu opened this issue Jun 8, 2014 · 12 comments
Closed

Limit annotation line length to 80 characters #192

ressu opened this issue Jun 8, 2014 · 12 comments
Assignees
Labels
Milestone

Comments

@ressu
Copy link

ressu commented Jun 8, 2014

Currently annotate doesn't really care about how long the annotated lines are. Since I'm a bit pedantic and like to keep running rubocop over my source files, I keep hitting a problem with certain models where annotations exceed the line length of 80 characters.

Since 80 characters is a common practice in many places it would be nice if annotate_models also had an option to limit the line length.

Also, it's worth mentioning that while there are ways to avoid this in models, the annotations in routes are pretty consistently over 80 characters. There is no real way of avoiding this, except not annotating routes.

@ctran ctran added the feature label Jun 9, 2014
@ctran
Copy link
Owner

ctran commented Jun 9, 2014

I'll be happy to accept a PR :-)

@ressu
Copy link
Author

ressu commented Jun 9, 2014

I was actually thinking about how to implement this while writing the issue report. Since there isn't really any good way of dividing lines, without having readability suffer, it might be a good idea if we could set a wrapper for the annotation. Rubocop for example allows a small wrapper that disables named scanners for that part of the code.

I'll see if I get a chance of implementing this later on.

@ctran ctran modified the milestone: v2.6.5 Jun 15, 2014
@ctran ctran added this to the neverland milestone Aug 5, 2014
@CyborgMaster
Copy link
Contributor

I also use rubocop and have the exact same issue. I would love the wrappers idea. I currently have to go and replace the rubocop disable wrapper comments every time the annotations update.

@ctran ctran removed this from the neverland milestone Aug 18, 2014
@oliverklee
Copy link

👍

1 similar comment
@sockmonk
Copy link

👍

@ctran ctran added this to the v2.6.6 milestone Jan 13, 2015
@ctran ctran self-assigned this Jan 13, 2015
@glittershark
Copy link

Would it be possible to add a configuration option for comment template in the meantime so we could put the necessary # rubocop:disable Style/LineLength comments as part of annotate?

@CyborgMaster
Copy link
Contributor

And a # rubocop:enable Style/LineLength at the bottom too so we don't turn it off for the whole file.

@glittershark
Copy link

Looked into implementing this myself and shortly after getting it all to work I realized #225 exists 😄 @CyborgMaster if you run annotate off the develop branch you can specify wrapper_open="rubocop:disable Metrics/LineLength" wrapper_close="rubocop:enable Metrics/LineLength" as arguments to the rake task

@CyborgMaster
Copy link
Contributor

@glittershark, that's pretty awesome!!! Thanks for the tip. I'll try it now.

@ctran ctran closed this as completed Mar 8, 2015
@dduqueti
Copy link

dduqueti commented Oct 2, 2017

@glittershark @CyborgMaster Thank you for this. I did found an issue, the initial annotation added the wrapper_open and wrapper_close texts but after adding a new field in a new migration, they were lost. Did you experienced this?

@CyborgMaster
Copy link
Contributor

CyborgMaster commented Oct 2, 2017

Yes, we have that too. There seems to be a bug where the rake task tied to the migrations seems to skip all the configuration. If I run annotate --force after the migration it puts it back.

@dduqueti
Copy link

dduqueti commented Oct 2, 2017

@CyborgMaster Thanks!

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

No branches or pull requests

7 participants