3 ms·
Can you show me a linter or a unit test that would reject that code?
by pault 7y ago
Can you show me a linter or a unit test that would reject that code?
- siscia 7y agoThe introduction of such tools serve not to prevent bad code to land, but to force people and code into a process. If somebody code is routinely denied to land on code base because of some of the issues catch by automatic tools, it is reasonable to assume that the quality of the code and the thought given to the code will improve. Is this person routinely writing code so bad that passes all the automatic tests? By the way, such code ends up having a quite high cyclomatic complexity.
- pault 7y ago> Is this person routinely writing code so bad that passes all the automatic tests? Yes, a linter or a test cannot know if you are writing silly, unnecessary code, or re-implementing functionality that already exists elsewhere, or making multiple changes downstream when you could make it once upstream. Only a human can see those things, which is why we have code reviews. And for posterity, yes we are using CI, pre-commit linters, unit tests, integration tests, end-to-end tests, and have formal branching, merging, review process, and coding standards. There are no cowboys here, and nothing that you are suggesting will prevent someone from writing low quality code that requires an excessive amount of time to protect the codebase from.