Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Checkstyle with configuration and SuppressionFilter on server

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...

like image 813
Ingo Avatar asked Jan 21 '10 15:01

Ingo


2 Answers

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.

like image 199
Pascal Thivent Avatar answered Sep 22 '22 08:09

Pascal Thivent


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}

like image 44
OTrain Avatar answered Sep 21 '22 08:09

OTrain