Skip to content

Tech manuals

Yevhen Danylov edited this page Nov 22, 2022 · 4 revisions

Checkstyle configuration for IntelliJ IDEA

  • Download the Checkstyle plugin.

  • Go to Settings -> Tools -> Checkstyle. Click on "+" (Add) Configuration File -> Use a local Checkstyle file -> Browse -> and choose configuration file in the root of the project - checkstyle.xml. Also add a description for this Checkstyle file, e.g. "TeachUA".

    Checkstyle plugin

  • Go to Settings -> Editor -> Code Style -> Java -> Choose Scheme : Default-> Settings -> Restore Defaults -> Duplicate -> Set the name(e.g TeachUA) -> Settings -> Import Scheme -> Checkstyle configuration -> and choose configuration file in the root of project - checkstyle.xml.

    Import Scheme

  • If you did everything right you can use hotkeys as Ctrl + Alt + L - for Formatting code, and Ctrl + Alt + O - for Optimizing imports.

  • Set running Checkstyle before building the project Go to Edit Configurations... -> Application -> Menu on bottom of settings("Before launch") -> "+" (Add task) -> "Run Maven Goal" -> Comand line : checkstyle:check.

    Maven goal

  • Also if you just want to check the project you can use the command: mvn checkstyle:check

  • IMPORTANT! Always before creating PR check the project with Checkstyle.

Happy coding!