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

LineLength: why 79? #1064

Closed
mockdeep opened this issue May 5, 2014 · 8 comments
Closed

LineLength: why 79? #1064

mockdeep opened this issue May 5, 2014 · 8 comments
Labels

Comments

@mockdeep
Copy link
Contributor

mockdeep commented May 5, 2014

Just to satisfy my curiosity, why is the LineLength default set to 79 instead of 80?

@jonas054
Copy link
Collaborator

jonas054 commented May 5, 2014

Although the style guide says "Limit lines to 80 characters." we check that each line is shorter than 80 characters, and it looks like it's one of my very early commits that made the change from 80 to 79. It's part of pull request #3 and I can't find that I discussed that particaular change at all so I guess now is a good time to do that. 😄

I've seen a 79 character limit in several style guides for various programming languages that I've used in my work. My guess is that it ultimately comes from 80 characters being a sort of de facto standard for old teletype terminals, and that this number was inherited into a lot of editors and other tools when graphical screens started to be common. The step down to 79 is for safety. Just in case there are tools that don't work well when the line uses the full width. The rightmost column could, for example, be needed for a symbol denoting line break, or for the cursor. In short; 79 should never be a problem, 80 might be.

@mockdeep
Copy link
Contributor Author

mockdeep commented May 5, 2014

Ah, I see. I suppose at this point since our ruby code isn't likely to be run on teletypes it's a little arbitrary either way. PEP-8 also limits it to 79, though they call it a nominal 80. We'll stick to 79 since it means I get to just delete the rule from my .rubocop.yml. What's one character more or less?

@jdickey
Copy link

jdickey commented May 6, 2014

I for one always have a local .rubocop.yml resetting the limit to 80 characters. I've been in the craft since the punched-card days (which is where the 80-column limit carried over to CRTs from); one of the great boons to mankind (or at least developerkind) from GUI-based environments is that fitting inside that limit has become as relevant as the buggy whip to traffic control.

80 columns is bad enough, even if historically defensible. 79, or anything less, is an S&M fetish.

@mockdeep
Copy link
Contributor Author

mockdeep commented May 6, 2014

Ha, I guess I haven't found it to be that difficult one way or the other. We only had a handful of lines in our codebase that were right on the 80 character line anyway. It's nice to have so I can zoom once or twice while pairing and still keep vertical columns, and it tends to clarify the code, though we have had to come up with some new rules for how to wrap lines.

@MattRogish
Copy link

I find that at the font size that my eyes can comfortably see (not too small, not too big), on a 27" Apple display, the line length for two side-by-side editor windows is well over 80 chars. Even my 13" MBA has a very comfortable line length greater than 80 chars.

I think the 80 char default is an anachronism that should be replaced with something bigger. Of course, what that should be is a shed of a different color. For reference, we set it to 100 in all of our projects.

@bbatsov
Copy link
Collaborator

bbatsov commented May 7, 2014

@jonas054 I guess it makes sense to make it 80 by default to avoid further confusion.

@jonas054
Copy link
Collaborator

jonas054 commented May 7, 2014

@bbatsov Right, we can't have this divide between the style guide and RuboCop. I should not have changed it to 79 without requesting the same change in the style guide.

For me personally, 79 feels like the industry standard for line lenghts, but that's highly subjective. If you think that changing the default in RuboCop to 80 is the best way to restore harmony in the universe, then I support your decision.

@bbatsov bbatsov closed this as completed in ffaf635 May 9, 2014
@bbatsov
Copy link
Collaborator

bbatsov commented May 9, 2014

@jonas054 I'll change the default to 80 in the interest of achieving world piece and reducing user confusion. :-)

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

5 participants