Re:Disable comments make static analysis tools worse
by globular-toast on Tuesday July 06, 2021 @07:11AM
(#27746774)
In my experience, you do not want to force your developers to fight with QC tools. If they consider it a battle, they will win and your software will lose. You want them to consider them as tools to help them improve their work.
Disable comments are useful but must be reviewed carefully. It would be good if code review tools like Gitlab could highlight certain regexps to flag them in code reviews. Often there is a simple solution and the comment will be removed in the code review. Other times, a ticket should be logged to address the problem later (in a refactor, for example).
Off the top of my head, some times when these comments are useful:
* You're doing a hotfix and don't have time to do the necessary refactor to fix the problem,
* You're certain that a subsequent refactor will remove the current code anyway,
* The code is legacy and fixing the problem now would cause much bigger changes,
* You just know you're right. For example, there are a few legitimate reasons for doing `import *` in Python, even if the QA tools can't see that.
Disable comments are useful but must be reviewed carefully. It would be good if code review tools like Gitlab could highlight certain regexps to flag them in code reviews. Often there is a simple solution and the comment will be removed in the code review. Other times, a ticket should be logged to address the problem later (in a refactor, for example).
Off the top of my head, some times when these comments are useful:
* You're doing a hotfix and don't have time to do the necessary refactor to fix the problem,
* You're certain that a subsequent refactor will remove the current code anyway,
* The code is legacy and fixing the problem now would cause much bigger changes,
* You just know you're right. For example, there are a few legitimate reasons for doing `import *` in Python, even if the QA tools can't see that.