Skip to content

Commit

Permalink
Fix rake prof:slow_cops to return correct results
Browse files Browse the repository at this point in the history
  • Loading branch information
fatkodima committed Aug 20, 2022
1 parent 27cce8b commit bd8a7ca
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tasks/prof.rake
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@ namespace :prof do

desc 'List the slowest cops'
task slow_cops: :run_if_needed do
method = 'RuboCop::Cop::Commissioner#trigger_responding_cops'
method = 'Kernel#public_send'
cmd = "stackprof #{dump_path} --text --method '#{method}'"
puts cmd
output = `#{cmd}`
_header, list, _code = *output
.lines
.grep_v(/RuboCop::Cop::Commissioner/) # ignore internal calls
.slice_after { |line| line.match?(/callees.*:|code:/) }
list = output.lines.grep(/RuboCop::Cop::.+#on_\w+/)
puts list.first(40)
end

Expand Down

0 comments on commit bd8a7ca

Please sign in to comment.