Permalink
Browse files

Line length checks no longer include trailing new lines in the count.

  • Loading branch information...
1 parent d518116 commit 3bd7d4031484e772a89ff8d13b48ce4922802395 @ToadJamb 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
View
@@ -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 3bd7d40

Please sign in to comment.