Permalink
Browse files

--doc-exclude supports globs same as style exclusion.

  • Loading branch information...
1 parent 628cc1e commit 8d3356ca34d074ed9192f6709d0d75e296a0b805 @xaviershay xaviershay committed Nov 17, 2012
Showing with 19 additions and 4 deletions.
  1. +5 −3 lib/cane/doc_check.rb
  2. +1 −1 lib/cane/style_check.rb
  3. +13 −0 spec/doc_check_spec.rb
View
@@ -18,8 +18,8 @@ def self.options
default: '{app,lib}/**/*.rb',
variable: 'GLOB',
clobber: :no_doc],
- doc_exclude: ['Exclude file from documentation checking',
- variable: 'FILE',
+ doc_exclude: ['Exclude file or glob from documentation checking',
+ variable: 'GLOB',
type: Array,
default: [],
clobber: :no_doc],
@@ -89,7 +89,9 @@ def extract_class_name(line)
end
def exclusions
- @exclusions ||= opts.fetch(:doc_exclude, []).flatten.to_set
+ @exclusions ||= opts.fetch(:doc_exclude, []).flatten.map do |i|
+ Dir[i]
+ end.flatten.to_set
end
def excluded?(file)
View
@@ -24,7 +24,7 @@ def self.options
cast: :to_i,
clobber: :no_style],
style_exclude: ['Exclude file or glob from style checking',
- variable: 'FILE',
+ variable: 'GLOB',
type: Array,
default: [],
clobber: :no_style],
View
@@ -84,4 +84,17 @@ class NeedsDocumentation
violations.length.should == 0
end
+
+ it 'skips declared glob-based exclusions' do
+ file_name = make_file <<-FILE.gsub /^\s{6}/, ''
+ class NeedsDocumentation
+ end
+ FILE
+
+ violations = check(file_name,
+ doc_exclude: ["#{File.dirname(file_name)}/*"]
+ ).violations
+
+ violations.length.should == 0
+ end
end

0 comments on commit 8d3356c

Please sign in to comment.