44

I've got a problem trying to import my check-style to IDEA 14. That's what I do:

  1. File -> Settings -> Inspections -> Import
  2. There I choose my checkstyle.xml and then I don't know why but TempProfile is created.
  3. Hmm, ok, looks like this TempProfile can check my code using my checkstyle.xml but it doesn't!
royhowie
  • 11,075
  • 14
  • 50
  • 67
Maxim Gotovchits
  • 729
  • 3
  • 11
  • 22

2 Answers2

69

Go to the Checkstyle configuration page via File → Settings, then typing checkstyle into the search box:

IntelliJ config editor

Press the plus icon to add your checkstyle.xml. Activate your checkstyle.xml by clicking the checkbox in the column labeled Active.

That's it!
If you want real-time scans, you can go to the Inspections dialog and activate the real-time scan:

IntelliJ Inspections Dialog

barfuin
  • 16,865
  • 10
  • 85
  • 132
  • 2
    Oh no! Unfortunately I don't have "checkstyle" in "Other Setting". There's Vim Emulation only =( – Maxim Gotovchits Nov 16 '14 at 23:27
  • 1
    @MaximGotovchits which plugin? I am also interested in solving this issue – Flowryn Jun 14 '16 at 10:38
  • Had installed Version 4.5.2 that I used and configured in Idea 14 one year ago. Now there is no "checkstyle" in "Other Setting" although the plugin is installed. Already did a reinstall and "Invalidate Caches / Restart" but checkstyle doesn't show up. Any suggestions? – syr Aug 16 '16 at 10:44
  • @ThomasJensen Could you please elaborate how to enable the real-time scan. And thanks for the steps to import checkstyle.xml Would something that works in eclipse work the same way in IntelliJ? – Nick Div Mar 08 '17 at 20:49
  • @NickDiv Added screenshot for inspections. – barfuin Mar 09 '17 at 16:52
  • Is there a way to make "code reformatting" follow this "checkstyle" too? – Islam Azab Mar 13 '18 at 14:31
40

In the new version you need to install a plugin called CheckStyle-IDEA

enter image description here

enter image description here

sendon1982
  • 9,982
  • 61
  • 44
  • 5
    After installing checkstyle as plugin you first need to click "Apply" or "OK" before you can find it. (took me now 10 min to find it, I even restarted IntelliJ, but only after I clicked "Apply" it really got installed. – Boommeister Mar 04 '21 at 09:40
  • 2
    @GrgKro good thing I saw your comment, I was dealing with the same issue – Catalin Florea May 13 '21 at 23:50
  • can somebody also let us know how to configure the suppressions.xml if its defined as variable in checkstyle.xml – Vivek Agrawal Apr 09 '22 at 20:06
  • I think if checkstyle version matches with xml file version, you did not need config anything. – sendon1982 Apr 11 '22 at 09:59