3

My company is switching from Eclipse to IntelliJ. In Eclipse we had a following configuration for suppression filters in checkstyle.xml

<module name="SuppressionFilter">
    <property name="file" value="${checkstyle.config.dir}/suppressions.xml"/>
</module>
<module name="SuppressionFilter">
    <property name="file" value="${common.checkstyle.config.dir}/global-suppressions.xml"/>
</module>

Where:

  • common.checkstyle.config.dir was an absolute path to the common project(module in IntelliJ).

  • checkstyle.config.dir was an relative path to the project(module), and has a value of checkstyle.config.dir=${root.dir}/config/checkstyle

We would like to define a path for this file in IntelliJ, so it would look for the suppression filter in each MODULE/config/checkstyle directory(each module has a different suppression).

Does anyone know if it is possible? We have tried to find a solution for quite some time, but no luck so far.

Zoe
  • 27,060
  • 21
  • 118
  • 148
sebastian89n
  • 63
  • 1
  • 7

1 Answers1

1

The Checkstyle integration in Eclipse is more powerful in some respects than the one in IntelliJ. This is one such case, I believe.

I would recommend changing the Checkstyle setup so that you have only one Checkstyle configuration and a central suppressions file for all modules. As you will see, modules are more tightly related in IntelliJ than projects are in Eclipse, so this is actually a good idea.

In order to keep module-specific configuration and/or suppressions, you would have to do the following:

  1. Define all of the module-specific configurations in the central Checkstyle settings (so you have module1-rules, module2-rules etc. in your list).
  2. In each module, select the appropriate configuration from the drop-down box.

This is quite a lot of work though, so I think you will find centralizing the configuration more convenient. (By the way, here are the supported variables, none of which will help you, I'm afraid.)

barfuin
  • 16,865
  • 10
  • 85
  • 132
  • Thank you for your answer Thomas! Could you tell me(or give me a link to the resource) how to define module-specific configurations in one checkstyle setting file? – sebastian89n Jul 20 '17 at 05:31