I've seen code like this (in test suites):
around do |example|
Site.skip_callback(:commit, :after, :after_owner_change)
example.run
ensure
Site.set_callback(:commit, :after, :after_owner_change, if: :saved_change_to_owner?)
end
And it might lead to thread-safety problems due to it's process-wide effect. I remember it was once related to ActiveJob's async adapter which uses thread pool under the hood.
This cop should not warn about class User < ApplicationRecord; skip_callback :commit, :after, :after_owner_change; end