Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed a line counting bug.

  • Loading branch information...
commit fc8372b1e8a595c0933e91015975160f601d69de 1 parent afa4f43
@martinjandrews martinjandrews authored
View
4 History.txt
@@ -1,3 +1,7 @@
+= 1.4.0
+
+* Upgraded from ParseTree to ruby_parser.
+
= 1.3.7
* Fixed a bug in the rake task where it always failed even if no errors existed.
View
2  Manifest.txt
@@ -30,8 +30,8 @@ lib/roodi/core.rb
lib/roodi/core/checking_visitor.rb
lib/roodi/core/error.rb
lib/roodi/core/iterator_visitor.rb
-lib/roodi/core/parse_tree_runner.rb
lib/roodi/core/parser.rb
+lib/roodi/core/runner.rb
lib/roodi/core/visitable_sexp.rb
lib/roodi_task.rb
roodi.yml
View
2  lib/roodi.rb
@@ -2,5 +2,5 @@
require 'roodi/core'
module Roodi
- VERSION = '1.3.7'
+ VERSION = '1.4.0'
end
View
2  lib/roodi/checks/line_count_check.rb
@@ -22,7 +22,7 @@ def evaluate(node)
protected
def count_lines(node)
- node.last.line - 2
+ node.last.line - node.line - 1
end
end
end
View
17 spec/roodi/checks/method_line_count_check_spec.rb
@@ -36,4 +36,21 @@ def two_line_method
errors.should_not be_empty
errors[0].to_s.should eql("dummy-file.rb:1 - Method \"two_line_method\" has 2 lines. It should have 1 or less.")
end
+
+ it "should count only lines from the method" do
+ content = <<-END
+ def first_method
+ puts 1
+ end
+
+ def second_method
+ puts 1
+ puts 2
+ end
+ END
+ @roodi.check_content(content)
+ errors = @roodi.errors
+ errors.should_not be_empty
+ errors[0].to_s.should eql("dummy-file.rb:5 - Method \"second_method\" has 2 lines. It should have 1 or less.")
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.