standard 1.28.0 → 1.28.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f90048ed9d5a6f7fb709f72f0ce48e3afca1207f4b75ec7673baaa77b7a15ed8
4
- data.tar.gz: e29c6e2e9c919611bfaf1ec1fb2907c0bb2552eb06a7a4340e45140ec0c0a2ad
3
+ metadata.gz: 38cefe66ce8063af630a8ce4e21f3565ae614d9b4b06ec977f42586123d110ba
4
+ data.tar.gz: 6281549367fe086c1c6118662c741ab1042493c2f98942fd1b6f6e64755bfb8f
5
5
  SHA512:
6
- metadata.gz: 53482d43182ade55a2828dd8fbd877c54dfc88cddf7dfdc842fb6a2ade273930fd43422dac37687f42617bfc35d2c65ac2b11211abad4e4d7f1a5409b5fa6cf3
7
- data.tar.gz: 84a62318f010f8361e94120f579fe24eca5d0ae7efc3cabe7175817f6ce799857ce95abbf59acfe3d898396464cd55231b2d29fd80dbfe781a9a561401e87312
6
+ metadata.gz: 4c6bf6c09d594f5a6bc2af47597e502d79717e8a5540d5214b20eb00222281bad3bcc01b2d48db1048df88229a67fc29ba1e2f7336aaf28e596b1aeed9cb5f11
7
+ data.tar.gz: ba211a922855471058ad9053684958532f82d8d160f763dd119d6bfa373dd0b63a408946e7134081b823c791f83febfa544a300232cfb8a4d2f0e0daad51ac15
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
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
+
7
+ ## 1.28.1
8
+
9
+ * Fixes plugin behavior caused by setting `DisabledByDefault: true` in `AllCops`
10
+ Effectively, a single lint_roller plugin whose `rules` were of type `:object`
11
+ would inadvertently mark all previously-defined rules as invalid.
12
+ [#557](https://github.com/standardrb/standard/pull/557)
13
+
3
14
  ## 1.28.0
4
15
 
5
16
  * Refactor Standard into 3 gems and convert all built-in configuration into
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- standard (1.28.0)
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)
@@ -23,7 +23,7 @@ GEM
23
23
  method_source (1.0.0)
24
24
  minitest (5.18.0)
25
25
  parallel (1.23.0)
26
- parser (3.2.2.0)
26
+ parser (3.2.2.1)
27
27
  ast (~> 2.4.1)
28
28
  rainbow (3.1.1)
29
29
  rake (13.0.6)
data/README.md CHANGED
@@ -15,7 +15,7 @@ supports plugins built with
15
15
 
16
16
  Standard Ruby was created and is maintained by the team at [Test
17
17
  Double](https://testdouble.com), because we appreciate the importance of
18
- balancing predictably consistent code with preserving developers' autonomy. 💚
18
+ balancing predictable, consistent code with preserving developer autonomy. 💚
19
19
 
20
20
  Topics covered in this README:
21
21
 
@@ -37,7 +37,7 @@ ever agree on what all the rules and format should be.**
37
37
 
38
38
  This has resulted in innumerable teams arguing how to configure their linters
39
39
  and formatters over literal decades. Some teams routinely divert time and energy
40
- from whatever they're building to reach concensus on where commas should go.
40
+ from whatever they're building to reach consensus on where commas should go.
41
41
  Other teams have an overzealous tech lead who sets up everything _his favorite
42
42
  way_ and then imposes his will on others. It's not uncommon to witness
43
43
  passive-aggressive programmers change a contentious rule back-and-forth,
@@ -63,9 +63,9 @@ for most of the ways people use Ruby, most of the time.
63
63
 
64
64
  If you adopt Standard Ruby, what's in it for you? Time saved that would've been
65
65
  spent arguing over how to set things up. Also, seamless upgrades: we stay on top
66
- of each new RuboCop rule ship an updated configuration on a monthly release
66
+ of each new RuboCop rule and update our configuration on a monthly release
67
67
  cadence. But the best part of adopting Standard as your linter and formatter?
68
- You'll spend a whole lot less time thinking about linters and formatters.
68
+ **You'll spend a whole lot less time thinking about linters and formatters.**
69
69
 
70
70
  So please, give Standard Ruby a try. If you're like [these
71
71
  folks](#who-uses-standard-ruby), you'll soon realize that the value of a linter
@@ -110,7 +110,7 @@ A majority of Standard's rules can be safely fixed automatically.
110
110
 
111
111
  ```
112
112
  # CLI
113
- $ standard --fix
113
+ $ standardrb --fix
114
114
 
115
115
  # Rake
116
116
  $ rake standard:fix
@@ -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
@@ -60,7 +59,8 @@ module Standard
60
59
  if rules.type == :path
61
60
  [RuboCop::ConfigLoader.load_file(rules.value), rules.value]
62
61
  elsif rules.type == :object
63
- [RuboCop::Config.new(rules.value), nil]
62
+ path = plugin.method(:rules).source_location[0]
63
+ [RuboCop::Config.create(rules.value, path, check: true), path]
64
64
  elsif rules.type == :error
65
65
  raise "Plugin `#{plugin.about&.name || plugin.inspect}' failed to load with error: #{rules.value.respond_to?(:message) ? rules.value.message : rules.value}"
66
66
  end
@@ -123,13 +123,32 @@ module Standard
123
123
  end
124
124
  end
125
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
+
126
134
  def fake_out_rubocop_default_configuration(options_config)
127
- og_default_config = RuboCop::ConfigLoader.instance_variable_get(:@default_configuration)
135
+ og_default_config = RuboCop::ConfigLoader.default_configuration
136
+ set_target_rails_version_on_all_cops_because_its_technically_not_allowed!(options_config)
128
137
  result = yield blank_rubocop_config(options_config)
129
138
  RuboCop::ConfigLoader.instance_variable_set(:@default_configuration, og_default_config)
130
139
  result
131
140
  end
132
141
 
142
+ # Avoid a warning that would otherwise be emitted by any plugin that set TargetRailsVersion
143
+ # because it's not a default AllCops key specified in RuboCop's embedded default config.
144
+ #
145
+ # See: https://github.com/rubocop/rubocop/pull/11833
146
+ def set_target_rails_version_on_all_cops_because_its_technically_not_allowed!(options_config)
147
+ return if !options_config.key?("AllCops") || options_config["AllCops"].key?("TargetRailsVersion")
148
+
149
+ options_config["AllCops"]["TargetRailsVersion"] = nil
150
+ end
151
+
133
152
  def blank_rubocop_config(example_config)
134
153
  RuboCop::Config.new(example_config.to_h.slice(*MANDATORY_RUBOCOP_CONFIG_KEYS), "")
135
154
  end
@@ -1,3 +1,3 @@
1
1
  module Standard
2
- VERSION = Gem::Version.new("1.28.0")
2
+ VERSION = Gem::Version.new("1.28.2")
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.28.0
4
+ version: 1.28.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-22 00:00:00.000000000 Z
11
+ date: 2023-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop