Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

But the thing to remember is that you don't need to have a rule of "lines must be no longer than this". Instead, it should be "aim for lines no longer than this", and then sometimes, you need longer because it makes sense in that specific case.


How can you make a linter for this?


If the author thinks it's okay, and the reviewer thinks it's okay, a robot that can't actually understand code doesn't need a vote.


The reason for the robot is to have an impartial judge where neither author nor reviewer are okay with the opposing judgement. At the end of the day, a human’s judgement cycle is better reserved for something of a higher priority/use.


Both parties should be able to cede style arguments graciously. You can't really win the argument by quoting policy, only postpone the argument and burn team goodwill.


Use warnings for long lines instead of errors?


Annotate the long line to ignore that particular linter rule. This makes it clear that it's not because the coder was lazy, ignorant, etc.


Wouldn’t that make the code less readable?

I think the point is that if 98% of your code fit under 110 chars when you weren’t using a linter, then maybe you don’t need a linter checking line length.


You can disable the max line length rule too.

I find linters helpful. Just yesterday it helped me catch a serious bug in Python. After fixing all linter warnings. The last one was a unused variable. Turns out it should have been used.

Sure, the line length is not as severe as a unused var, but that's why the important thing is to have a systematic approach to thinking about maybe-problems that the "compiler" doesn't care about.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: