Automatically fix pmd errors. Is it possible?

I just inherited a bunch of code from another developer, and our company established some new code style rules. So now I have 300 pmd errors saying: "The parameter" blablahlblah "is not assigned and can be declared final." I really don't want to do all this manually, and I just need to put a “final” modifier in front of every variable that causes this pmd error. Is there any simple way to do this, besides writing some script, to consume pmd output and modify the source files accordingly? I use IntelliJ too. Maybe this can help me?

+3
source share
1 answer

Use Analyze| Inspect Code, it will provide you with a list of results grouped by check, a quick fix can often be applied to the entire group of results, so you can add finalto all the places that this check finds with one click.

+3
source

All Articles