Permalink
Browse files

Merge pull request #5 from ToadJamb/bugs/line-length-includes-new-lines

Line length checks no longer include trailing new lines in the count.
  • Loading branch information...
2 parents d518116 + 3bd7d40 commit 7402e3131400f0abc57164d6c51b79b0153db5a8 @xaviershay xaviershay committed Mar 6, 2012
Showing with 9 additions and 1 deletion.
  1. +1 −1 lib/cane/style_check.rb
  2. +8 −0 spec/cane_spec.rb
@@ -81,7 +81,7 @@ def spacing_conditions
# Copy of parent method using a configurable line length.
def too_long?
- length = self.length
+ length = self.chomp.length
if length > line_length_max
print_problem "Line is >#{line_length_max} characters (#{length})"
return true
View
@@ -54,6 +54,14 @@ def complex_method(a)
output.should include("Lines violated style requirements")
end
+ it 'does not include trailing new lines in the character count' do
+ file_name = make_file('#' * 80 + "\n" + '#' * 80)
+
+ output, exitstatus = run("--style-glob #{file_name} --style-measure 80")
+ exitstatus.should == 0
+ output.should be_empty
+ end
+
it 'allows upper bound of failed checks' do
file_name = make_file("whitespace ")

0 comments on commit 7402e31

Please sign in to comment.