Skip to content

Commit

Permalink
factored out some code in the line count checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjandrews committed Sep 18, 2008
1 parent 6304497 commit e606318
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/roodi/checks/class_line_count_check.rb
Expand Up @@ -10,7 +10,8 @@ class ClassLineCountCheck < LineCountCheck
DEFAULT_LINE_COUNT = 300

def initialize(options = {})
super([:class], options['line_count'], 'Class')
line_count = options['line_count'] || DEFAULT_LINE_COUNT
super([:class], line_count, 'Class')
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/roodi/checks/line_count_check.rb
Expand Up @@ -3,10 +3,10 @@
module Roodi
module Checks
class LineCountCheck < Check
def initialize(interesting_nodes, configured_line_count, message_prefix)
def initialize(interesting_nodes, line_count, message_prefix)
super()
@interesting_nodes = interesting_nodes
@line_count = configured_line_count || DEFAULT_LINE_COUNT
@line_count = line_count
@message_prefix = message_prefix
end

Expand Down
3 changes: 2 additions & 1 deletion lib/roodi/checks/method_line_count_check.rb
Expand Up @@ -11,7 +11,8 @@ class MethodLineCountCheck < LineCountCheck
DEFAULT_LINE_COUNT = 20

def initialize(options = {})
super([:defn], options['line_count'], 'Method')
line_count = options['line_count'] || DEFAULT_LINE_COUNT
super([:defn], line_count, 'Method')
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion lib/roodi/checks/module_line_count_check.rb
Expand Up @@ -10,7 +10,8 @@ class ModuleLineCountCheck < LineCountCheck
DEFAULT_LINE_COUNT = 300

def initialize(options = {})
super([:module], options['line_count'], 'Module')
line_count = options['line_count'] || DEFAULT_LINE_COUNT
super([:module], line_count, 'Module')
end
end
end
Expand Down

0 comments on commit e606318

Please sign in to comment.