standard 1.28.1 → 1.28.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8c0920e71bbf9f203f59f683dfaec09f0b5828546a4b47d9d72079aa2a8fda9
4
- data.tar.gz: 53cce6a924e050971619a48ae411dba9e002f0c3cdd48588c3f7a2ee68e20c9f
3
+ metadata.gz: 38cefe66ce8063af630a8ce4e21f3565ae614d9b4b06ec977f42586123d110ba
4
+ data.tar.gz: 6281549367fe086c1c6118662c741ab1042493c2f98942fd1b6f6e64755bfb8f
5
5
  SHA512:
6
- metadata.gz: f8d4318e2527b6f2d20308caa846ba861a1432a9b1930ebfd2003475eed86dc0b095191cc64f1415a8d6f6130e82923e792cbadfc686eb60401a18026ea8b0df
7
- data.tar.gz: e1fa000dc59e5c530a369238ddc1beb75470d10deb191709bc9d84546b39a327bb4bd80ee80202ec81fc788fee8cd8af588ccab75a4f111457336a16af3a9e52
6
+ metadata.gz: 4c6bf6c09d594f5a6bc2af47597e502d79717e8a5540d5214b20eb00222281bad3bcc01b2d48db1048df88229a67fc29ba1e2f7336aaf28e596b1aeed9cb5f11
7
+ data.tar.gz: ba211a922855471058ad9053684958532f82d8d160f763dd119d6bfa373dd0b63a408946e7134081b823c791f83febfa544a300232cfb8a4d2f0e0daad51ac15
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.28.2
4
+
5
+ * Attempts to fix the not-actually fixed plugin behavior in 1.28.1
6
+
3
7
  ## 1.28.1
4
8
 
5
9
  * Fixes plugin behavior caused by setting `DisabledByDefault: true` in `AllCops`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- standard (1.28.1)
4
+ standard (1.28.2)
5
5
  language_server-protocol (~> 3.17.0.2)
6
6
  lint_roller (~> 1.0)
7
7
  rubocop (~> 1.50.2)
@@ -27,17 +27,16 @@ module Standard
27
27
 
28
28
  def call(options_config, standard_config, plugins, permit_merging:)
29
29
  runner_context = @creates_runner_context.call(standard_config)
30
- plugin_config = combine_rubocop_configs(options_config, runner_context, plugins).to_h
30
+ plugin_config = combine_rubocop_configs(options_config, runner_context, plugins, permit_merging: permit_merging).to_h
31
31
  merge_config_into_all_cops!(options_config, plugin_config)
32
32
  merge_config_into_standard!(options_config, plugin_config, permit_merging: permit_merging)
33
33
  end
34
34
 
35
35
  private
36
36
 
37
- def combine_rubocop_configs(options_config, runner_context, plugins)
37
+ def combine_rubocop_configs(options_config, runner_context, plugins, permit_merging:)
38
+ all_cop_keys_configured_by_plugins = all_cop_keys_previously_configured_by_plugins(options_config, permit_merging: permit_merging)
38
39
  fake_out_rubocop_default_configuration(options_config) do |fake_config|
39
- all_cop_keys_configured_by_plugins = []
40
-
41
40
  plugins.reduce(fake_config) do |combined_config, plugin|
42
41
  RuboCop::ConfigLoader.instance_variable_set(:@default_configuration, combined_config)
43
42
  next_config, path = config_for_plugin(plugin, runner_context)
@@ -49,7 +48,7 @@ module Standard
49
48
  )
50
49
  delete_already_configured_keys!(combined_config.keys, next_config, dont_delete_keys: ["AllCops"])
51
50
 
52
- RuboCop::ConfigLoader.merge_with_default(next_config, path)
51
+ RuboCop::ConfigLoader.merge_with_default(next_config, path, unset_nil: false)
53
52
  end
54
53
  end
55
54
  end
@@ -61,7 +60,7 @@ module Standard
61
60
  [RuboCop::ConfigLoader.load_file(rules.value), rules.value]
62
61
  elsif rules.type == :object
63
62
  path = plugin.method(:rules).source_location[0]
64
- [RuboCop::Config.create(rules.value, path), path]
63
+ [RuboCop::Config.create(rules.value, path, check: true), path]
65
64
  elsif rules.type == :error
66
65
  raise "Plugin `#{plugin.about&.name || plugin.inspect}' failed to load with error: #{rules.value.respond_to?(:message) ? rules.value.message : rules.value}"
67
66
  end
@@ -124,8 +123,16 @@ module Standard
124
123
  end
125
124
  end
126
125
 
126
+ def all_cop_keys_previously_configured_by_plugins(options_config, permit_merging:)
127
+ if permit_merging
128
+ []
129
+ else
130
+ Array(options_config["AllCops"]&.keys) - RuboCop::ConfigLoader.default_configuration["AllCops"].keys
131
+ end
132
+ end
133
+
127
134
  def fake_out_rubocop_default_configuration(options_config)
128
- og_default_config = RuboCop::ConfigLoader.instance_variable_get(:@default_configuration)
135
+ og_default_config = RuboCop::ConfigLoader.default_configuration
129
136
  set_target_rails_version_on_all_cops_because_its_technically_not_allowed!(options_config)
130
137
  result = yield blank_rubocop_config(options_config)
131
138
  RuboCop::ConfigLoader.instance_variable_set(:@default_configuration, og_default_config)
@@ -137,9 +144,9 @@ module Standard
137
144
  #
138
145
  # See: https://github.com/rubocop/rubocop/pull/11833
139
146
  def set_target_rails_version_on_all_cops_because_its_technically_not_allowed!(options_config)
140
- return unless options_config.key?("AllCops")
147
+ return if !options_config.key?("AllCops") || options_config["AllCops"].key?("TargetRailsVersion")
141
148
 
142
- options_config["AllCops"]["TargetRailsVersion"] = "~"
149
+ options_config["AllCops"]["TargetRailsVersion"] = nil
143
150
  end
144
151
 
145
152
  def blank_rubocop_config(example_config)
@@ -1,3 +1,3 @@
1
1
  module Standard
2
- VERSION = Gem::Version.new("1.28.1")
2
+ VERSION = Gem::Version.new("1.28.2")
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.28.1
4
+ version: 1.28.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls