standard 1.28.1 → 1.28.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/standard/plugin/merges_plugins_into_rubocop_config.rb +16 -9
- data/lib/standard/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38cefe66ce8063af630a8ce4e21f3565ae614d9b4b06ec977f42586123d110ba
|
4
|
+
data.tar.gz: 6281549367fe086c1c6118662c741ab1042493c2f98942fd1b6f6e64755bfb8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c6bf6c09d594f5a6bc2af47597e502d79717e8a5540d5214b20eb00222281bad3bcc01b2d48db1048df88229a67fc29ba1e2f7336aaf28e596b1aeed9cb5f11
|
7
|
+
data.tar.gz: ba211a922855471058ad9053684958532f82d8d160f763dd119d6bfa373dd0b63a408946e7134081b823c791f83febfa544a300232cfb8a4d2f0e0daad51ac15
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -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.
|
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
|
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)
|
data/lib/standard/version.rb
CHANGED