You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by "Wim C (JIRA)" <ji...@apache.org> on 2013/07/31 17:07:50 UTC

[jira] [Updated] (BUILDR-672) Buildr checkstyle plugin is always returning a new instance of the properties Hash

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

{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}

  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.

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

Possible solution :

{code:ruby}
    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
{code}

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

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