#360 Build in Properties not expanded in default-attribute

5.6.2
wont-fix
None
1
2014-09-23
2013-12-24
Benjamin Klatt
No

The auto expansion of built-in properties (http://eclipse-cs.sourceforge.net/advanced_properties.html) does work only in the value attribute but not in the default attribute.
Supporting both would help for example to configure different property settings for local IDE development and build server.

For example:
This setting does not work:
<module name="SuppressionFilter">
<property name="file" value="suppressions.xml" default="${samedir}/supressions.xml"/>
</module>

This setting does:
<module name="SuppressionFilter">
<property name="file" value="${samedir}/suppressions.xml"/>
</module>

Discussion

  • Actually this seems to be a limitation/feature of the Checkstyle core itself.

    I dug into where the property expansion is taking place in Checkstyle and the source comment said this about the default value:

     * @param aDefaultValue default to use if one of the properties in aValue
     *              cannot be resolved from aProps.
    

    So it seems that it is by design that property expansion only works in the value attribute and the default only kicking in when the property itself (not the file behind the path!) is not resolved.

    Please file a feature request over at the Checkstyle project if you're feeling strong about this.
    Otherwise there are several articles around at the interweb, which describe how a uniform Maven/Sonar/eclipse-cs setup can work.

     
    • status: open --> wont-fix
    • assigned_to: Lars Koedderitzsch