7

I have configured my Eclipse to use a remote checkstyle configuration that is located on a server, which I reach via HTTP. This works fine, but the configuration contains:

<module name="SuppressionFilter">
<property name="file" value="${basedir}/checkstyle-filter.xml"/>
</module>

So I try to set an additional property "basedir" which points to the same directory where the configuration is. When I try to run checkstyle on a project I get an error: cannot initialize module SuppressionsFilter - Cannot set property 'file' in module SuppressionFilter to 'http://"my Url "/checkstyle-filter.xml'

Any suggestions on how to configure Eclipse to use the checkstyle configuration from the server even though it has that it contains the SuppressionFilter? I do not want to put a checkstyle-filter in each project...

3 Answers 3

10

This is currently not possible as reported in Remote Configuration Files cannot use a SuppressionFilter - ID: 2018081. Actually, the problem is in Checkstyle which uses a java.io.File object for the external SuppressionFilter file (and thus setting a value starting with http:// won't work). There is a feature request on Checkstyle to change this (see Allow remote references to additional file configuration - ID: 2018608). But don't expect these changes to occur very soon (unless if you start working hard on it :)

That being said, while I perfectly understand the need for a corporate wide checkstyle configuration file, I'm more surprised by the need for a shared SuppressionFilter file. After all, its content is project specific, isn't it? So, I think that you should actually use another property, for example ${workspace} (or your own property, my understanding of Expanding property placeholders is that using a .properties file is supposed to work with a Remote Configuration too) and ask each project to provide its own file with its SuppressionFilter that would be referenced from the workspace. Based on convention, that should work.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you very much for the detailed answer. The thing is that the projects are all very similar in the way that they all generate source code that does not conform with the checkstyle configuration, and does not need to do that either. I will skip to have it as remote configuration, I will just use the extensionpoints in eclipse-cs and include the confuiguration in a plugin which I include in the distribution.
You're welcome. And now I understand better, it would make sense in your case indeed. BTW: The common way of recognizing a good answer is upvoting it ;-).
I'm new to Stackoverflow and get a "Vote Uprequires 15 reputation", I will upvote it once I reach there. Guess I should contribute and answer some posts myself ;) I'll keep that in mind, thanx
1

Actually, you can use a suppression filter. I have it setup this way with a remote config using the 5.6 eclipse checkstyle plugin. Just put the suppression file in the same remote directory as the checkstyle.xml file and then use the following:

<property name="file" value="${config_loc}/suppression.xml" />

It will then work with eclipse. Basically just replace ${base_dir} with ${config_loc}

Comments

0

I wasn't able to add a patch to the original feature request, so I created a new feature request here: https://sourceforge.net/tracker/?func=detail&atid=397081&aid=3485185&group_id=29721

I've implemented this functionality as I needed it to be able to corporate-wide disable certain checks for unit tests and Eclipse-generated NLS classes.

I've tested it with the 5.5 version of eclipse-cs by patching the jar file for the plugin and it works quite well.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.