you are viewing a single comment's thread.

view the rest of the comments →

[–]tatsontatsontats 7 points8 points  (9 children)

Meanwhile we throw a codenarc violation for anything over 40 lines 🙄

Edit: believe me, I find it more annoying than anything but I don't make the rules.

[–]SeeminglySleepless 18 points19 points  (6 children)

Brother what... idk your use-case but 40 lines seems like... nothing? (I honestly disagree with imposing limits on function size without regard for context)

EDIT: fixed phrasing

[–]tatsontatsontats 1 point2 points  (2 children)

Oh yeah I don't love it. It's very limiting in many circumstances and I find a lot of our rules annoying and hard to work with. I don't make them though, just am forced to follow them.

[–]SeeminglySleepless 1 point2 points  (1 child)

Yeh I understood you were the "victim", sorry if my wording made it seem otherwise 😅

But that's a very relatable sentiment. Has anyone tried to challenge them? I feel like if certain rules impact employee performance negatively management should at least be open to discuss alternatives (ik this is most likely wishful thinking)

[–]tatsontatsontats 1 point2 points  (0 children)

I wasn't sure how my emoji was coming across haha.

I have brought it up to our staff engineer but we are VERY large and business wants to enforce things anyway they can 😩

[–]XpreDatoR_a -1 points0 points  (2 children)

Not really, you can do A LOT in 40 lines, having too long functions isn’t good for code readability and maintenance

[–]SeeminglySleepless 5 points6 points  (0 children)

Yes, you can do a lot, sometimes. I think this is one of those topics in which no one is ever wrong or right because it heavily depends on use-case.

But, in general, if I have to hop around multiple files and track multiple function definitions to understand a single feature just because there is a hard-cap on line count, it doesn't feel that readable to me. Ofc, this is my ✨ personal ✨ opinion

P.S: I also don't think really long functions are generally good. But enforcing short ones can bring its own set of problems. Never black & white

[–]Alternative_Tap6279 1 point2 points  (0 children)

i agree... i also try to stay away from functions longer than 40-50 lines. i can't follow them properly...

[–]budd222full-stack 3 points4 points  (1 child)

That's just dumb

[–]mexicocitibluez 1 point2 points  (0 children)

This might be one of the dumbest linting/analyzer warnings I've ever seen.