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

At my last job, there was a frontend developer who added a linter rule that variable names must be at least 2 characters long. The project already had 20,000 lines of code. Every time anyone made a change to a file, they would have to rename all the one letter variables. Usually, this meant all the for loops in the file. I tried to explain how pointless this rule was, but he wasn't having any of it.

Most people just renamed variables like i > ii, which was worse.



a good linter rule would have exceptions for loop variables by context by just by name like i, j, k. Often just by name is good enough at least for a solo dev or small team. I require them to be at least 3 chars EXCEPT those.

For example: https://clang.llvm.org/extra/clang-tidy/checks/readability/i...


What is even the point of digging in deeper, did they not see everyone around them doing the i>ii workaround? You've lost, call it a failed experiment and move on.


Eye and Jay are go to as well




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

Search: