-
Notifications
You must be signed in to change notification settings - Fork 2
docs: Update recommended line length to 120 characters in coding stan… #5
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
base: main
Are you sure you want to change the base?
Conversation
|
How many characters of code per line does the average developer's editor show in a single window with a comfortable font size and reasonably sized display? For me it's about 270, but I almost always have (at minimum) a vertical split, so the effective comfortable character count drops to ~135. 120 is quite close to that. But I suspect most people have bigger displays or slightly smaller font sizes. Do we have any guesstimates? I'd prefer to base the recommendation on something other than "seems like a nice round number". What I am attempting to say is that I am all for increasing the line length, as 80 is silly on a modern display; discounting the case that you're expected to have 3-4 vertically split windows at the same time. But should the limit actually be a little bit higher than 120? |
|
I think the safe default should still be 80 from portability point of view and also side by side diffs. Many open source projects still limit to 80 characters (google c++ as an example, PEP8 etc.) |
|
Portability isn’t really a factor for us. We’re not integrating this code into other SDKs or external code bases, so line length has no impact on portability in our case. As for the claim that “many open source projects still enforce 80”: that’s true in some ecosystems (e.g., Python’s PEP8, some older Unix projects), but the trend is clearly shifting. A lot of large projects have relaxed the limit: Google C++: 100 chars Java (Oracle): 100 chars .NET / C#: often 120 chars Linux kernel: no longer treats 80 as a hard rule; maintainers explicitly allow 100–120 when it improves readability So while 80 is still common, it’s not the universal default anymore. Given modern displays and tooling, it seems more practical to align with the 100–120 range, which balances readability with editor flexibility. |
|
80 has proved to be too small over the years, I am glad we are bumping it to 120. |
|
I know that: I see the benefits of having 120 on a wide screen monitor and high res monitors, but we humans (or is it just a mortal like me?) aren't used to such drastic changes in eye movements and I suggest we limit to increasing it by 25% (i.e., 100) instead of 50% increase from the current limitations |
|
I've been using line-length of 120 for quite a few years now in my projects. It great improves code readability especially for those std::chrono<> type situations in C++ (the list of specifiers only keeps on increasing there) and in Python when one starts using type hints. 100 is good but there are situations where I felt that the leeway of a few more characters was way better. (I even had two rulers rendered in my IDE at one point, one at 100 and the other at 120, 100 being the warning point). I vote for 120. |
|
Hi @aautotte ! Thanks for the PR!. We just had a vote in the SW arch meeting and we agree to increase the length. However, the majority wants a line length of 100, not 120. Could you update this PR, or make a new one for 100? |
Update recommended line length to 120 characters in coding standard