3

I followed the instructions in this response: https://stackoverflow.com/a/35273850/1122470

However, after using the automatic formatting CtrlShiftAltL, the code was reformatted for sure, yes, but I am not sure if it was according to the checkstyle.xml

When I try to check for violations using gradlew checkstyle all the previous errors seem to remain.

Any suggestions on how to get the formatting done according to the checkstyle rules using the plugin?

Edit: adding config screenshots

enter image description here

Codestyle settings

slava
  • 791
  • 1
  • 11
  • 26
okkhoy
  • 1,298
  • 3
  • 16
  • 29
  • are both (idea and gradle) using the same checkstyle config? – sschrass Oct 27 '18 at 08:16
  • yes! both are using the same config file – okkhoy Oct 27 '18 at 08:31
  • Try to press `ctrl+shift+a` and type `checkstyle` - there should be actions related to checkstyle plugin. – extempl Oct 27 '18 at 08:33
  • So have you imported checkstyle config and doesn't see it is applied? (latest IDEA import location: https://duaw26jehqd4r.cloudfront.net/items/263S3o3U0m1J2f3z200k/Image%202018-10-27%20at%2011.41.17.png?v=cdfc6738). You should set the rule which will say for sure, was it applied or not, as you're not sure it works. – extempl Oct 27 '18 at 08:43
  • @extempl Please check the updated question (I added the screenshots) and please confirm if that is what you meant! If so, I have applied the configurations – okkhoy Oct 27 '18 at 09:15
  • Try to import checkstyle configuration from the `Code Style -> Java` page. As you're importing it globally, so it may be overridden by local (Java) rules. – extempl Oct 27 '18 at 09:20
  • Also after importing make sure the imported scheme is selected in the `Scheme` dropdown beside the gear wheel icon. As of the first screenshot - it looks like it is only for checking, not formatting. – extempl Oct 27 '18 at 09:22
  • The same configuration is applied under `Code Style -> Java` page and it is the selected scheme. Example of a specific problem: organize imports isn't moving the code around. – okkhoy Oct 27 '18 at 09:34

0 Answers0