How to configure multiple CheckStyle formats/rules for different scopes in Intellij 13

StackOverflow https://stackoverflow.com/questions/23520977

  •  17-07-2023
  •  | 
  •  

Domanda

I have two checkstyle files to target sources and the other for test-sources. Using Checkstyle-Idea plugin for intellij I can only configure one set of rules for the entire project.

Is it possible to configure different checkstyle's for different scopes?

È stato utile?

Soluzione

Good question. I know this is possible in the Eclipse IDE via the Checkstyle plugin's GUI. But in IntelliJ, the GUI can't seem to do that. So you'll probably end up filing a feature request with the Checkstyle-IDEA folks. Until it gets implemented, here are two workarounds:

You could put your test classes into a separate "test project". This is something I'd really hate to do, actually wouldn't want to, especially if you already have a large number of projects to begin with.

A better workaround might be to use IntelliJ's inspections, which are also very powerful and may cover the cases where you need rules to differ. Inspections can be applied to scopes (e.g. only to tests), which is just what you need.
Then you would use Checkstyle for everything that is the same across the entire project, and use IntelliJ's inspections for checks that you only want to perform on a smaller scope.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top