4 ms·
The fact that your unit tests did not catch that bug tells me you should spend less time linting and more time covering.
by michaelmcmillan 10y ago
The fact that your unit tests did not catch that bug tells me you should spend less time linting and more time covering.
- crdoconnor 10y agoLinting is cheaper than unit testing.
- michaelmcmillan 10y agoThey serve two completely different purposes. Testing ensures the logic is correct, linting is checking the code for syntax errors and bad practice.
- crdoconnor 10y agoThey don't actually serve completely different purposes. Linting is supposed to catch bugs and it does, very cheaply. It just doesn't catch very many. In terms of coding style I've found it fairly ineffective at picking up on most bad practices.
- michaelmcmillan 10y agoSure, "bug" as a term is as elastic as you want it to be. I was pointing out the false equivalence you implied by writing "cheaper". Testing and linting does not provide the same value, so calling it cheaper is a kind of fallacy.
- crdoconnor 10y agoThat's like saying that a sandwich and a condo do not provide the same value so calling a sandwich cheaper is a kind of fallacy. There's no elasticity over what the OP reported. That was a bug. Clear as they come. He may have unit tests but they didn't catch it and since you can't have unit tests for everything, why not spend 500ms running a linter?
- michaelmcmillan 10y agoYou are making my point. It makes no sense to call a sandwich cheaper than a condo when you are evaluating what to buy when looking for a place to live. That is what I was pointing out. Testing and linting does different things. Of course a sandwich is cheaper than a condo, but what does that have to do with what we are talking about? As for the claim that you can't have unit tests for everything: What do you mean? No, you can't test all branches or combinations in a system, but you can have a 100% test coverage (aka. hitting each line at least once).
- crdoconnor 10y ago>You are making my point. It makes no sense to call a sandwich cheaper than a condo when you are evaluating what to buy when looking for a place to live. That is what I was pointing out. Yeah not really. Both linting and unit tests catch bugs. This is a fact that you refuse to actually face. >you can have a 100% test coverage You can but it's A) a bad idea and B) it won't even necessarily catch the bug that the OP brought up if you do.
- michaelmcmillan 10y agoI grant you that linting catches bugs, but what I've argued for (perhaps badly) is that the bugs it catches are very shallow, but more importantly they make up a relatively small subset of the bugs proper unit tests catch. That's what makes the comparison you made deceptive. I use both linting (pylint actually) and unit tests, so I am not advocating that you should scrap your linting tools. I am just trying to point out the difference. Your B) argument is yet another indication that the tests are not good enough. The example bug OP posted is what made me comment in the first place. If your tests don't catch that your tests are useless.
- itamarst 10y agoIn fact there were unit tests. They didn't catch it though, see comments elsewhere.
- michaelmcmillan 10y agoI know they were there, but they are obviously useless. Hence my comment: Fix your tests.