airbnb / ruby

Ruby Style Guide

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tighten up line length section

venantius opened this issue · comments

I think, in line with the discussion going on in #74, that the current section on line length is probably quite a bit longer than needs to be in the main page. I think it's sufficient to say that lines shouldn't be over 100 characters, and link to a larger section in rationales.md explaining why and providing mitigation strategies. Thoughts?

I like your thoughts.

Makes sense to me. The main guide could probably just keep the first two sentences: "Keep each line of code to a readable length. Unless you have a reason to, keep lines to fewer than 100 characters." Or even just "Unless you have a reason to, keep lines to fewer than 100 characters."

Since line length is just an arbitrary boundary chosen as a proxy for code clarity/complexity, I also generally enjoy including a sentence like "Consider using intermediate variables or separate methods to aid readability without requiring long lines"

@ljharb Disagree about the justification for a character limit; an 80-100 character limit is usually set because otherwise things get messy for those of us who work in terminals. It's neither arbitrary nor related to code complexity.

My terminal is about 200 lines wide, surely your screen is big enough for a couple of those? :trollface:

"lines" are vertical, how can they be wide? :trollface:

bah, s/lines/columns

mauahahahaha

100-110 characters is aboutthe width of text in sublime on my laptop screen.
Also i think it's like 110ish characters displayed in github depending upon their mood, it seems to change.

100 is a nice round number ;) for people who say it's not enough i say, at least it's not 80 😉

I prefer 80, but we do 100 here. I am fine with 100.

fwiw, our JS guide is 100 right now, but will likely end up 120 before too long.

How come 120?

Let's not bikeshed the JS choice on the ruby repo - but tl;dr, #76 (comment) + "80 → 100 → 120" seems like nice round numbers.

I see. If you do 120 for JS, I will have wrapping lines of code on my editor since I set my break point at 100 :(

Let's leave it as 100 I don't think there is a good reason to change it.

100 is nice, not too far off from 80.

I mean, we should do 100 if for no other reason than that as part of bootcamp we've been pushing 100-character line limits into every new engineer's vimrc etc for a year now.

The worst thing you can do to an arbitrary limit is keep changing it without a compelling reason 😉