Skip to content

Configuring custom SDK checkstyle with IntelliJ

Jair edited this page Aug 22, 2022 · 8 revisions

This Checkstyle Plugin enables on-demand scanning of Java files so that they conform to our CheckStyle rules, from within IntelliJ IDEA.

Steps:

  1. Make sure you’ve got Checkstyle-IDEA plugin (9.21 version). If not, install via  File → Settings… → Plugins → Browse Repositories.

  2. Build sdk-build-tools-1.0.0.jar.

    Compile the latest sdk-build-tools-1.0.0.jar from here.

    mvn clean install -f C:\~\Java\azure-sdk-for-java\eng\code-quality-reports\pom.xml

  3. Open File > Settings > Tools > CheckStyle

    3.1. Add the path of sdk-build-tools-1.0.0.jar to the Third-Party Checks as below:

    3.2. Click "+" to add a new custom checkstyle configuration file.

    3.3. Add a description for the checkstyle configuration.

    3.4. Click "Browse" and add the checkstyle configuration file in your local folder under eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml

    3.5. Click Next

  4. Add checkstyle suppression file path.

    Since the suppression file is in the same local directory enter "/".

  5. Click "Next", you should get the following dialog. Click "Finish" to complete this setup.

  6. This is the final screen of the checkstyle setup. Select the checkbox "sdk-checkstyle" and click Apply.

  7. Verify the checkstyle results. Go to a Java file, Click on "Check Current File" or "Check Module" or "Check Project" to run the custom sdk-checkstyle configuration on your project.

Clone this wiki locally