rewrite
rewrite copied to clipboard
Create a search recipe for commented out code. `RSPEC-125`
Programmers should not comment out code as it bloats programs and reduces readability.
Unused code should be deleted and can be retrieved from source control history if required
https://rules.sonarsource.com/java/RSPEC-125
OpenRewrite's motto is "do no harm" and while this is generally a good policy to not have commented-out code, auto-remediation of such situations is likely to remove things the user does not want removed. I could maybe see developing a search recipe for pattern that provides parity with the sonarqube rule.
OpenRewrite's motto is "do no harm" and while this is generally a good policy to not have commented-out code, auto-remediation of such situations is likely to remove things the user does not want removed. I could maybe see developing a search recipe for pattern that provides parity with the sonarqube rule.
Would it be possible to develop a separate recipe that leverages the git history?
Example : deleted commented out code older than n time
In any case, this recipe is meant to be enabled and reviewed manually by the users. I don't see how it could cause harm
In any case, this recipe is meant to be enabled and reviewed manually by the users. I don't see how it could cause harm
This is one use case, where you run a recipe once, and then forget about it.
The other use case where's it could cause harm, is when you want to keep a good state for new code, and setup your CI to check if configured recipes don't generate changes (you see that as a linter). You can achieve that with the dryrun-goal of maven plugin. In that case you don't want to have human intervention to validate if changes are good or bad.
In any case, this recipe is meant to be enabled and reviewed manually by the users. I don't see how it could cause harm
This is one use case, where you run a recipe once, and then forget about it.
The other use case where's it could cause harm, is when you want to keep a good state for new code, and setup your CI to check if configured recipes don't generate changes (you see that as a linter). You can achieve that with the dryrun-goal of maven plugin. In that case you don't want to have human intervention to validate if changes are good or bad.
I think that this will happen with all the recipes