[ 
https://issues.apache.org/jira/browse/BUILDR-672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Wim C updated BUILDR-672:
-------------------------

    Description: 
If we use properties in the checkstyle configuration file (see snippt below), 
we can not set these properties on the checkstyle extension.
The checkstyle.properties method is always returning a new instance of the 
properties Hash.

  <module name="SuppressionFilter">
    <property name="file" value="${config.dir}/suppressions.xml"/>
  </module>

Possible solution :
    def properties
      @properties ||= original_properties
    end

    private
    def original_properties
      properties = {:basedir => self.project.base_dir}
      properties['checkstyle.suppressions.file'] = self.suppressions_file if 
File.exist?(self.suppressions_file)
      properties['checkstyle.import-control.file'] = self.import_control_file 
if File.exist?(self.import_control_file)
      properties
    end

  was:
If we use properties in the checkstyle configuration file (see snippt below), 
we can not set these properties on the checkstyle extension.
The checkstyle.properties method is always returning a new instance of the 
properties Hash.

{noformat}
  <module name="SuppressionFilter">
    <property name="file" value="${config.dir}/suppressions.xml"/>
  </module>
{noformat}

Possible solution :

{noformat}
    def properties
      @properties ||= original_properties
    end

    private
    def original_properties
      properties = {:basedir => self.project.base_dir}
      properties['checkstyle.suppressions.file'] = self.suppressions_file if 
File.exist?(self.suppressions_file)
      properties['checkstyle.import-control.file'] = self.import_control_file 
if File.exist?(self.import_control_file)
      properties
    end
{noformat}

    
> Buildr checkstyle plugin is always returning a new instance of the properties 
> Hash
> ----------------------------------------------------------------------------------
>
>                 Key: BUILDR-672
>                 URL: https://issues.apache.org/jira/browse/BUILDR-672
>             Project: Buildr
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: 1.4.12
>            Reporter: Wim C
>            Priority: Minor
>
> If we use properties in the checkstyle configuration file (see snippt below), 
> we can not set these properties on the checkstyle extension.
> The checkstyle.properties method is always returning a new instance of the 
> properties Hash.
>   <module name="SuppressionFilter">
>     <property name="file" value="${config.dir}/suppressions.xml"/>
>   </module>
> Possible solution :
>     def properties
>       @properties ||= original_properties
>     end
>     private
>     def original_properties
>       properties = {:basedir => self.project.base_dir}
>       properties['checkstyle.suppressions.file'] = self.suppressions_file if 
> File.exist?(self.suppressions_file)
>       properties['checkstyle.import-control.file'] = self.import_control_file 
> if File.exist?(self.import_control_file)
>       properties
>     end

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to