Some checkstyle rules don't work in gradle

I have multi module project. I’ve added checkstyle plugin to my project with configured rules.

The problem is that some rules don’t work for me (such as: http://checkstyle.sourceforge.net/config_misc.html#Translation, http://checkstyle.sourceforge.net/config_misc.html#UniqueProperties, http://checkstyle.sourceforge.net/config_misc.html#NewlineAtEndOfFile)

I’ve already created new topic for checkstyle support, but there we’ve found out that the problem must be related to gradle.

You can see full configuration and examples by this link: https://groups.google.com/forum/#!topic/checkstyle/8JGCfpYLrV0

I can reproduce this problem with:
checkstyle plugin of latest version 6.17
gradle 2.12
java 8
multi module project with maven archetypes

It seems that checkstyle plugin doesn’t see resources

Do you have any ideas how to solve the problem?

Could you provide a simple project that expose the faulty behavior?

I reduced an example out of here: https://github.com/sevntu-checkstyle/checkstyle-samples

The issue is that Gradle only checks Java sources by default (not resources).

I opened GRADLE-3432

You can add all of the sources (Java+resources) with

checkstyleMain {
   source sourceSets.main.allSource
}

But this won’t restrict it to only *.properties (it’ll check every file in src/main/resources, which is maybe not what you want).

thanks,
new problem is that violations are showed twice in console (duplications)

for instance for LineLength check
http://checkstyle.sourceforge.net/config_sizes.html#LineLength

Duplication violations are showed in console and report files

is it possible to fix?

You can try

checkstyleMain {
   source = sourceSets.main.allSource
}

This replaces the list of sources instead of appending to the list of sources to check (which already includes the Java sources).