3

I followed the step add checkstyle

Here are the specific steps: Setup Steps

  1. Go to IntelliJ -> Preferences -> Plugins -> Browse repositories.
  2. Search for and Install the "Checkstyle-IDEA" plugin, restart IntelliJ.
  3. Go to IntelliJ -> Preferences -> Other Settings -> Checkstyle.
  4. Under "Configuration File" click "+" and name the description "Customized Checkstyle".
  5. Click on "Use a checkstyle file accessible via HTTP" and "ignore invalid certificates".
  6. For the URL use: https://drive-xxxxxxxxx.xxxxxx.com/view/xxxxx/checkstyle-rules.xml (corporate website) click "Next" and then click "Finish".
  7. Click on the checkbox for "Customized Checkstyle", click "Apply" and "OK".

And I can run in real-time checkstyle to my code. However, when I reformat the code, the formatted code does not match the checkstyle, could you please let me know what I did wrong?

1 Answer 1

6

Code formatting is a separate thing from checkstyle. But you can convert checkstyle to a IDEA's code formatting: Settings -> File | Settings | Editor | Code Style and on the left hand side of the Scheme there is cog, click on it, then Import Scheme -> CheckStyle Configuration:

screenshot

Note that you will need to download the checkstyle xml config file.

Sign up to request clarification or add additional context in comments.

3 Comments

I spent quite some time trying to find this answer, hope it gets more light :) Thanks, streetturtle
How is code formatting different then check style ?
I think streetturtle meant that that detection of style violations and fixing style violations are two different things

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.