Skip to content

Commit

Permalink
Merge pull request rubocop#10941 from fatkodima/fix-prof-slow_cops
Browse files Browse the repository at this point in the history
Fix `rake prof:slow_cops` to return correct results
  • Loading branch information
koic committed Aug 20, 2022
2 parents 27cce8b + bd8a7ca commit 23a3924
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tasks/prof.rake
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 23a3924

Please sign in to comment.