diff --git a/lib/brakeman/processors/alias_processor.rb b/lib/brakeman/processors/alias_processor.rb index 511b7c69a7..eb104a8276 100644 --- a/lib/brakeman/processors/alias_processor.rb +++ b/lib/brakeman/processors/alias_processor.rb @@ -602,7 +602,7 @@ def process_hash exp if node_type? exp, :hash if exp.any? { |e| node_type? e, :kwsplat and node_type? e.value, :hash } kwsplats, rest = exp.partition { |e| node_type? e, :kwsplat and node_type? e.value, :hash } - exp = Sexp.new.concat(rest).line(exp) + exp = Sexp.new.concat(rest).line(exp.line) kwsplats.each do |e| exp = process_hash_merge! exp, e.value diff --git a/lib/brakeman/processors/controller_processor.rb b/lib/brakeman/processors/controller_processor.rb index 13fad1a1f1..f325415e14 100644 --- a/lib/brakeman/processors/controller_processor.rb +++ b/lib/brakeman/processors/controller_processor.rb @@ -192,8 +192,8 @@ def add_fake_filter exp filter_name = ("fake_filter" + rand.to_s[/\d+$/]).to_sym args = exp.block_call.arglist - args.insert(1, Sexp.new(:lit, filter_name)) - before_filter_call = make_call(nil, :before_filter, args) + args.insert(1, Sexp.new(:lit, filter_name).line(exp.line)) + before_filter_call = make_call(nil, :before_filter, args).line(exp.line) if exp.block_args.length > 1 block_variable = exp.block_args[1] @@ -210,9 +210,9 @@ def add_fake_filter exp #Build Sexp for filter method body = Sexp.new(:lasgn, block_variable, - Sexp.new(:call, Sexp.new(:const, @current_class.name), :new)) + Sexp.new(:call, Sexp.new(:const, @current_class.name).line(exp.line), :new).line(exp.line)).line(exp.line) - filter_method = Sexp.new(:defn, filter_name, Sexp.new(:args), body).concat(block_inner).line(exp.line) + filter_method = Sexp.new(:defn, filter_name, Sexp.new(:args).line(exp.line), body).concat(block_inner).line(exp.line) vis = @visibility @visibility = :private diff --git a/lib/brakeman/processors/haml_template_processor.rb b/lib/brakeman/processors/haml_template_processor.rb index df7c9589cb..5009017d47 100644 --- a/lib/brakeman/processors/haml_template_processor.rb +++ b/lib/brakeman/processors/haml_template_processor.rb @@ -179,7 +179,7 @@ def get_pushed_value exp, default = :output clauses = [get_pushed_value(exp.then_clause), get_pushed_value(exp.else_clause)].compact if clauses.length > 1 - s(:or, *clauses) + s(:or, *clauses).line(exp.line) else clauses.first end diff --git a/lib/brakeman/processors/template_processor.rb b/lib/brakeman/processors/template_processor.rb index 82e8d7cf6e..3502c5562b 100644 --- a/lib/brakeman/processors/template_processor.rb +++ b/lib/brakeman/processors/template_processor.rb @@ -61,9 +61,9 @@ def normalize_output arg branches = [arg.then_clause, arg.else_clause].compact if branches.empty? - s(:nil) + s(:nil).line(arg.line) elsif branches.length == 2 - Sexp.new(:or, *branches) + Sexp.new(:or, *branches).line(arg.line) else branches.first end diff --git a/lib/ruby_parser/bm_sexp.rb b/lib/ruby_parser/bm_sexp.rb index 7fab76ae8b..c84239dbed 100644 --- a/lib/ruby_parser/bm_sexp.rb +++ b/lib/ruby_parser/bm_sexp.rb @@ -40,7 +40,7 @@ def deep_clone line = nil s.line(line) else s.original_line = self.original_line - s.line(self.line) + s.line(self.line) if self.line end s