i went absolutely apeshit on a linter two months ago:
it barfed up a message like "you are adding elements to this array in a fixed-size loop, preallocate space for it first" for some test setup code that was like,
for (int i = 0; i < 1000; i++) { vector.emplace(blah blah); }
so the guy fixing all this linter garbage typoed
vector.resize(1000);
instead of
vector.reserve(1000);
so a bunch of unit tests were now using a homogeneous pile of default-constructed elements
does the linter warn you about "hey, you have a big vector of identical default-constructed elements and then you added 1000 actual randomized test objects to it that none of your code will ever touch?" — no, of course not, that's too complicated for it
Yeah - computers can't read code - and the people writing linters suck - it's hard - I think they're a net good - but seriously - they get in the way so often
I get why the linter said it - but - horrible - these are both *good* uses for a linter - but fuck - that shouldn't have passed review. But - seriously - make the linter not dumb, and make it make suggestions if it has some.
Also - why the fuck are they populating a vector with a loop?!
Alex P. 👹
in reply to silverwizard • • •i went absolutely apeshit on a linter two months ago:
it barfed up a message like "you are adding elements to this array in a fixed-size loop, preallocate space for it first" for some test setup code that was like,
for (int i = 0; i < 1000; i++) { vector.emplace(blah blah); }
so the guy fixing all this linter garbage typoed
vector.resize(1000);
instead of
vector.reserve(1000);
so a bunch of unit tests were now using a homogeneous pile of default-constructed elements
…
silverwizard likes this.
Alex P. 👹
in reply to Alex P. 👹 • • •â€¦
does the linter warn you about "hey, you have a big vector of identical default-constructed elements and then you added 1000 actual randomized test objects to it that none of your code will ever touch?" — no, of course not, that's too complicated for it
¯\_(ツ)_/¯
silverwizard likes this.
silverwizard
in reply to Alex P. 👹 • •Alex P. 👹
in reply to silverwizard • • •silverwizard likes this.
silverwizard
in reply to Alex P. 👹 • •I mean - a compiler warning and a linter is definitely similar.
But yeah - the compiler will usually say "you're an idiot, but I'll allow it' instead of "fuck off and rewrite it"
silverwizard
in reply to Alex P. 👹 • •I get why the linter said it - but - horrible - these are both *good* uses for a linter - but fuck - that shouldn't have passed review.
But - seriously - make the linter not dumb, and make it make suggestions if it has some.
Also - why the fuck are they populating a vector with a loop?!
Alex P. 👹
in reply to silverwizard • • •the actual code is more like
for (blah blah) {
// do some rng shit to make a funny object and maybe connect it to some other objects
vector.emplace(blah blah);
}
silverwizard likes this.
silverwizard
in reply to Alex P. 👹 • •featureFlag new_ui = false; #fuck-off-linter-I-mean-this