Repository: buildr
Updated Branches:
  refs/heads/master 71b1f5fef -> 9419f244d


Add `exclude_paths` setting to pmd addon to allow paths to be explicitly 
excluded.


Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/9419f244
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/9419f244
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/9419f244

Branch: refs/heads/master
Commit: 9419f244d6defa82b3a2fd276cd4c88d6d949d20
Parents: 71b1f5f
Author: Peter Donald <[email protected]>
Authored: Thu Mar 3 12:49:54 2016 +1100
Committer: Peter Donald <[email protected]>
Committed: Thu Mar 3 12:49:54 2016 +1100

----------------------------------------------------------------------
 CHANGELOG           | 1 +
 addon/buildr/pmd.rb | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/9419f244/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 237f4ee..f2d1b87 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,5 @@
 1.4.24 (Pending)
+* Added:  Add `exclude_paths` setting to pmd addon to allow paths to be 
explicitly excluded.
 * Fixed:  Update jDepend addon to ensure target directories are invoked prior 
to attempting
           to analyze directories.
 * Added:  Add jdepend.additional_project_names configuration to jDepend addon 
to

http://git-wip-us.apache.org/repos/asf/buildr/blob/9419f244/addon/buildr/pmd.rb
----------------------------------------------------------------------
diff --git a/addon/buildr/pmd.rb b/addon/buildr/pmd.rb
index 7d08144..4dc4519 100644
--- a/addon/buildr/pmd.rb
+++ b/addon/buildr/pmd.rb
@@ -89,7 +89,7 @@ module Buildr
       attr_writer :rule_set_files
 
       def rule_set_files
-        @rule_set_files ||= (self.rule_set_artifacts.empty? ? 
['rulesets/java/basic.xml', 'rulesets/java/imports.xml', 
'rulesets/java/unusedcode.xml', 'rulesets/java/finalizers.xml', 
'rulesets/java/braces.xml'] : [])
+        @rule_set_files ||= (self.rule_set_artifacts.empty? ? 
%w(rulesets/java/basic.xml rulesets/java/imports.xml 
rulesets/java/unusedcode.xml rulesets/java/finalizers.xml 
rulesets/java/braces.xml) : [])
       end
 
       # Support specification of rule sets that are distributed as part of a 
maven repository
@@ -125,6 +125,11 @@ module Buildr
         @source_paths ||= [self.project.compile.sources, 
self.project.test.compile.sources].flatten.compact
       end
 
+      # An array of paths that should be excluded no matter how they are added 
to pmd
+      def exclude_paths
+        @source_paths ||= []
+      end
+
       # An array of additional projects to scan for main and test sources
       attr_writer :additional_project_names
 
@@ -140,7 +145,7 @@ module Buildr
           paths << [p.compile.sources, p.test.compile.sources].flatten.compact
         end
 
-        paths.flatten.compact
+        paths.flatten.select{|p|!self.exclude_paths.include?(p)}.compact
       end
 
       protected

Reply via email to