Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow README file to be lowercase

Fixes #42
  • Loading branch information...
commit 15430f03c544a8a82e05ed4569aa35947b0d4584 1 parent 4735ab1
@benmoss benmoss authored
Showing with 12 additions and 7 deletions.
  1. +9 −7 lib/cane/doc_check.rb
  2. +3 −0  spec/doc_check_spec.rb
View
16 lib/cane/doc_check.rb
@@ -54,13 +54,15 @@ def find_violations(file_name)
def missing_file_violations
result = []
- unless opts[:no_readme]
- unless ['', '.txt', '.md'].any? {|x| Cane::File.exists?("README#{x}") }
- result << {
- description: 'Missing documentation',
- label: 'No README found'
- }
- end
+ return result if opts[:no_readme]
+
+ filenames = ['README', 'readme']
+ extensions = ['', '.txt', '.md']
+ combinations = filenames.product(extensions)
+
+ if combinations.none? {|n, x| Cane::File.exists?(n + x) }
+ result << { description: 'Missing documentation',
+ label: 'No README found' }
end
result
end
View
3  spec/doc_check_spec.rb
@@ -60,6 +60,9 @@ class Doc; end
file.should_receive(:exists?).with("README").and_return(false)
file.should_receive(:exists?).with("README.md").and_return(false)
file.should_receive(:exists?).with("README.txt").and_return(false)
+ file.should_receive(:exists?).with("readme").and_return(false)
+ file.should_receive(:exists?).with("readme.md").and_return(false)
+ file.should_receive(:exists?).with("readme.txt").and_return(false)
violations = check("").violations
violations.length.should == 1
Please sign in to comment.
Something went wrong with that request. Please try again.