Intellij IDEA checkstyle

84,477

Solution 1

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

Solution 2

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

enter image description here

enter image description here

Share:
84,477
Maxim Gotovchits
Author by

Maxim Gotovchits

I'm a CS student of MIPT. I study combinatorics, number theory, algebra, maths logic, group theory, C/C++, Java etc.

Updated on July 09, 2022

Comments

  • Maxim Gotovchits
    Maxim Gotovchits almost 2 years

    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!
  • Maxim Gotovchits
    Maxim Gotovchits over 9 years
    Oh no! Unfortunately I don't have "checkstyle" in "Other Setting". There's Vim Emulation only =(
  • Flowryn
    Flowryn almost 8 years
    @MaximGotovchits which plugin? I am also interested in solving this issue
  • syr
    syr almost 8 years
    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?
  • Nick Div
    Nick Div about 7 years
    @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?
  • barfuin
    barfuin about 7 years
    @NickDiv Added screenshot for inspections.
  • Islam Azab
    Islam Azab about 6 years
    Is there a way to make "code reformatting" follow this "checkstyle" too?
  • JSON derulo
    JSON derulo about 3 years
    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.
  • Catalin Florea
    Catalin Florea about 3 years
    @GrgKro good thing I saw your comment, I was dealing with the same issue
  • Vivek Agrawal
    Vivek Agrawal about 2 years
    can somebody also let us know how to configure the suppressions.xml if its defined as variable in checkstyle.xml
  • sendon1982
    sendon1982 about 2 years
    I think if checkstyle version matches with xml file version, you did not need config anything.