@@ -12,6 +12,7 @@ class Issue < SimpleDelegator
1212 def initialize ( issue , path , cop_list : nil )
1313 @path = path
1414 @cop_list = cop_list
15+
1516 super ( issue )
1617 end
1718
@@ -73,8 +74,8 @@ def overage_points
7374
7475 def multiplier
7576 result = message . scan ( MULTIPLIER_REGEX )
76- score , max = result [ 0 ]
77- score . to_i - max . to_i
77+ score , threshold = result [ 0 ]
78+ score . to_i - threshold . to_i
7879 end
7980
8081 def category
@@ -94,29 +95,25 @@ def positions
9495 }
9596 end
9697
97- # Increment column value as columns are 0-based in parser
98+ # Increments column values as columns are 0-based in parser
9899 def columns
99100 return @columns if defined? ( @columns )
100101
101- if location . is_a? ( RuboCop ::Cop ::Lint ::Syntax ::PseudoSourceRange )
102- @columns = [ location . column + 1 , location . column + 1 ]
103- else
104- @columns = [ location . column + 1 , location . last_column + 1 ]
105- end
102+ end_column = location . try ( :last_column ) || location . column
103+ @columns = [ location . column + 1 , end_column + 1 ]
106104 end
107105
108106 def lines
109107 return @lines if defined? ( @lines )
110108
111- if location . is_a? ( RuboCop ::Cop ::Lint ::Syntax ::PseudoSourceRange )
112- @lines = [ location . line , location . line ]
113- else
114- @lines = [ location . first_line , location . last_line ]
115- end
109+ begin_line = location . try ( :first_line ) || location . line
110+ end_line = location . try ( :last_line ) || location . line
111+ @lines = [ begin_line , end_line ]
116112 end
117113
118114 def content_body
119115 return @content_body if defined? ( @content_body )
116+
120117 content_path = expand_config_path ( "contents/#{ cop_name . underscore } .md" )
121118 @content_body = File . exist? ( content_path ) && File . read ( content_path )
122119 end
0 commit comments