From 0ce75ec6e9f720bb3113fd334da4abd53fa4a739 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Tue, 20 Feb 2024 14:44:56 +1100 Subject: [PATCH] Add rubocop binstub for spring support I observed a significant speed-up on the second run. The first run seems to be a lot slower though. Additional output suggests that it's now loading the Rails environment which it doesn't do without spring. ``` time bundle exec rubocop Gemfile 0m2.496s time rubocop Gemfile # not always right version 0m1.999s time ./bin/rubocop Gemfile 0m7.543s time ./bin/rubocop Gemfile 0m0.670s ``` --- Gemfile | 1 + Gemfile.lock | 3 +++ bin/rubocop | 4 ++++ bin/spring | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100755 bin/rubocop diff --git a/Gemfile b/Gemfile index 259e59200e7..fba0e12183e 100644 --- a/Gemfile +++ b/Gemfile @@ -188,6 +188,7 @@ group :development do gem 'rubocop-rails' gem 'spring' gem 'spring-commands-rspec' + gem 'spring-commands-rubocop' gem 'web-console' gem 'rack-mini-profiler', '< 3.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index 716fdd01ba1..bdd52ec98ac 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -704,6 +704,8 @@ GEM spring (4.1.3) spring-commands-rspec (1.0.4) spring (>= 0.9.1) + spring-commands-rubocop (0.4.0) + spring (>= 1.0) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -925,6 +927,7 @@ DEPENDENCIES spreadsheet_architect spring spring-commands-rspec + spring-commands-rubocop state_machines-activerecord stimulus_reflex (= 3.5.0.rc3) stimulus_reflex_testing diff --git a/bin/rubocop b/bin/rubocop new file mode 100755 index 00000000000..671f09c3ee7 --- /dev/null +++ b/bin/rubocop @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +load File.expand_path("spring", __dir__) +require 'bundler/setup' +load Gem.bin_path('rubocop', 'rubocop') diff --git a/bin/spring b/bin/spring index 37f429ba024..a81373ab6e6 100755 --- a/bin/spring +++ b/bin/spring @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -# This file loads Spring without using loading other gems in the Gemfile, in order to be fast. +# This file loads Spring without loading other gems in the Gemfile in order to be fast. # It gets overwritten when you run the `spring binstub` command. if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"])