-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add first line in method and class #9
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
class ParseClass < EndableParseState | ||
def initialize(lexer,parent=nil) | ||
super(lexer,parent) | ||
@first_line = lexer.line_no | ||
@type_name = "Class" | ||
end | ||
|
||
|
@@ -15,7 +16,7 @@ def compute_state(formater) | |
child.kind_of?(ParseClass) | ||
end | ||
|
||
formater.start_class_compute_state(@type_name,@name,self.calc_complexity,self.calc_lines) | ||
formater.start_class_compute_state(@type_name,@name,self.calc_complexity,@first_line,self.calc_lines) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [105/80] |
||
super(formater) | ||
formater.end_class_compute_state(@name) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ class ParseDef < EndableParseState | |
|
||
def initialize(lexer,parent=nil) | ||
super(lexer,parent) | ||
@first_line = lexer.line_no | ||
@complexity = 1 | ||
@looking_for_name = true | ||
@first_space = true | ||
|
@@ -53,7 +54,7 @@ def parse_token(token) | |
end | ||
|
||
def compute_state(formater) | ||
formater.def_compute_state(@name, self.calc_complexity, self.calc_lines) | ||
formater.def_compute_state(@name, self.calc_complexity, @first_line, self.calc_lines) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [89/80] |
||
super(formater) | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ def compute_state_for_global(formater) | |
return if global_def.empty? | ||
gx = global_def.inject(0) { |c,s| s.calc_complexity } | ||
gl = global_def.inject(0) { |c,s| s.calc_lines } | ||
formater.start_class_compute_state("Global", "", gx, gl) | ||
formater.start_class_compute_state("Global", "", gx, 0, gl) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer single-quoted strings when you don't need string interpolation or special symbols. |
||
global_def.each do |s| | ||
s.compute_state(formater) | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,20 +8,20 @@ def start(new_out=nil) | |
def end | ||
end | ||
|
||
def start_class_compute_state(type_name,name,complexity,lines) | ||
def start_class_compute_state(type_name,name,complexity,first_line,lines) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Space missing after comma. |
||
@current = name | ||
@out.puts "-- START #{name} --" | ||
@out.puts "Type:#{type_name} Name:#{name} Complexity:#{complexity} Lines:#{lines}" | ||
@out.puts "Type:#{type_name} Name:#{name} Complexity:#{complexity} FirstLine:#{first_line} Lines:#{lines}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [110/80] |
||
end | ||
|
||
def end_class_compute_state(name) | ||
@out.puts "-- END #{name} --" | ||
end | ||
|
||
def def_compute_state(name,complexity,lines) | ||
def def_compute_state(name,complexity,first_line,lines) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Space missing after comma. |
||
return if @filter.ignore?(complexity) | ||
warn_error?(complexity, name) | ||
@out.puts "Type:Def Name:#{name} Complexity:#{complexity} Lines:#{lines}" | ||
@out.puts "Type:Def Name:#{name} Complexity:#{complexity} FirstLine:#{first_line} Lines:#{lines}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [101/80] |
||
end | ||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,25 +14,26 @@ def end | |
@out.puts "</html>" | ||
end | ||
|
||
def start_class_compute_state(type_name,name,complexity,lines) | ||
def start_class_compute_state(type_name,name,complexity,first_line,lines) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Space missing after comma. |
||
@current = name | ||
@out.puts "<div class=\"class_complexity\">" | ||
@out.puts "<h2 class=\"class_name\">#{type_name} : #{name}</h2>" | ||
@out.puts "<div class=\"class_first_line\">First Line: #{first_line}</div>" | ||
@out.puts "<div class=\"class_total_complexity\">Total Complexity: #{complexity}</div>" | ||
@out.puts "<div class=\"class_total_lines\">Total Lines: #{lines}</div>" | ||
@out.puts "<table width=\"100%\" border=\"1\">" | ||
@out.puts "<tr><th>Method</th><th>Complexity</th><th># Lines</th></tr>" | ||
@out.puts "<tr><th>Method</th><th>Complexity</th><th>First Line</th><th># Lines</th></tr>" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [94/80] |
||
end | ||
|
||
def end_class_compute_state(name) | ||
@out.puts "</table>" | ||
@out.puts "</div>" | ||
end | ||
|
||
def def_compute_state(name, complexity, lines) | ||
def def_compute_state(name, complexity, first_line, lines) | ||
return if @filter.ignore?(complexity) | ||
klass = warn_error?(complexity, name) | ||
@out.puts "<tr><td>#{name}</td><td#{klass}>#{complexity}</td><td>#{lines}</td></tr>" | ||
@out.puts "<tr><td>#{name}</td><td#{klass}>#{complexity}</td><td>#{first_line}</td><td>#{lines}</td></tr>" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [110/80] |
||
end | ||
|
||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [112/80]