4

I am trying to auto fix my gradle checkstyle errors instead of manually fixing each individual one. I have installed the checkstyle plugin: https://plugins.jetbrains.com/plugin/1065-checkstyle-idea and I am trying to follow these steps: How fix all check style issues with Intellij Idea? but it doesn't seem to be working as when i press ctrl + alt + l, my code gets formatted but the checkstyle errors do not get fixed.

Dan
  • 53
  • 1
  • 7

1 Answers1

0

Press Ctrl+Alt+Shift+L to get the Reformat Code dialog where you can enable the Code cleanup option:

cleanup

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • Nothing seems to happen... When I perform this action and then re-run the CheckStyle-IDEA scan, all warnings are still present. – rocksNwaves May 27 '21 at 19:41
  • @rocksNwaves This is for built-in IntelliJ IDEA functionality. CheckStyle-IDEA is a third-party plug-in and may work differently. – CrazyCoder May 27 '21 at 19:42
  • Ah, interesting! Is the IntelliJ IDEA built in checkstyle configurable? Can I point it to an XML file, then delete the CheckStyle-IDEA plugin? – rocksNwaves May 27 '21 at 19:44
  • @rocksNwaves Yes, see https://www.jetbrains.com/help/idea/code-inspection.html. – CrazyCoder May 27 '21 at 19:46
  • Hmm. Following that page, I found the "Code Style issues" inspection. I see that I can select or unselect what I want it to look for, but no way to point it to an XML file. I have a Maven checkstyle plugin being run when I build. It has an associated checkstyle xml file. I want to point IntelliJ at this file so that Intellij can correct my formatting errors. – rocksNwaves May 27 '21 at 20:00