3
votes

I am using IntelliJ IDEA version 2017.3, then I install plug-in CheckStyle-IDEA v 5.16.0 successful, I install Apache Maven Checkstyle Plugin to run myCheckFile.xml. At install phase, I received many check style error like:

Indentation: '.' has incorrect indentation level 6, expected level should be 8.
Indentation: 'new' has incorrect indentation level 6, expected level should be 8.

After importing CheckStyle settings, I expect when I hit Ctrl+Alt+L inside IntelliJ IDEA all check style error will die but that doesn't happen, is there's something i'm missing ?

1
checkstyle is not combined with the formatter. You need to tell the formatter explicitly what to do. - Thorbjørn Ravn Andersen
Could you please share your checkstyle scheme? May be not all settings are supported by IDEA formatter. - y.bedrov
If you install Save Actions plugin and configure it to reformat on save then it'll automatically format for you - Archmede

1 Answers

0
votes

You might have a .editorconfig file which is taking precedence. I ran into the same problem and my solution was to comment out the .editorconfig file. Our team is using JHipster, which automatically generates a .editorconfig file. This generally has just a few key settings, including indent_size=4. I was experimenting with Google's checkstyle xml settings and saw the same overall issue you were seeing, where the checkstyle plugin was indicating the indentation was wrong, but the code/reformat option wasn't fixing it.

TL;DR - see if you have a .editorconfig file and if so delete it or comment out the conflicting styles.