Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions benchmarks/rubocop/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,25 @@
# integrates with RuboCop
class RuboCopRunner < RuboCop::Runner
def initialize
super(
::RuboCop::Options.new.parse(
[
"--stderr",
"--force-exclusion",
"--format",
"RuboCop::Formatter::BaseFormatter",
"--raise-cop-error",
"--autocorrect",
]
).first,
::RuboCop::ConfigStore.new
)

args = [
"--stderr",
"--force-exclusion",
"--format",
"RuboCop::Formatter::BaseFormatter",
"--raise-cop-error",
"--autocorrect",
# Without this, RuboCop searches upwards for a .rubocop.yml (and falls back to
# ~/.rubocop.yml), so the amount of work done would depend on where this repo
# happens to be checked out. Always benchmark against RuboCop's default config.
"--force-default-config",
]
options, _paths = ::RuboCop::Options.new.parse(args)

config_store = ::RuboCop::ConfigStore.new
# This is how `RuboCop::CLI` applies the option to the config store
config_store.force_default_config! if options[:force_default_config]

super(options, config_store)
end

def run(path, contents)
Expand Down
Loading