standard-performance 1.1.1 → 1.2.0

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: d3313cb1b98296491d99d1c41ba34d8fb1d23554a3db84466c38a74bba905762
4
- data.tar.gz: 0fde13d39f95f79376ae9c848a180661f708168033395cb0d66bb3a04ef57aba
3
+ metadata.gz: 1e3de877fbeba90b5e1d960e1d0be37066c3056782bb9c7d8cb8a9cf68015cb3
4
+ data.tar.gz: e5ff45b0503319d7d32edd0145cea9d7bf90b8de6ce8a78b4743b022d2c3d5cd
5
5
  SHA512:
6
- metadata.gz: 6c0e97d9db245d0a97e1a4cb35cd2835de358b98d973056a8c6e2f0f4353e6fbf7d935f8c7da9d8d6667d7f7a4e0e4bafffc17f49e627b41ffb9051c4fc1b567
7
- data.tar.gz: bdf5658c49bfb5e21c58c22dc00db7e335217eab5c8cbd0afbf4779aab2421b2e8acba81ef7ed316b1160b9b4cb03b613f8988b89923d80b8df745fb31e8a240
6
+ metadata.gz: ee17264a5ebf2a0ea998076d630a42ee40d21f0fe348b2fbb01d7c0803c8999318417f0492939d47189bcdca628c69dc62db9bca8a5aa368041c813361a2c25f
7
+ data.tar.gz: 56f03d54f49d953654e17051de0c5301ae7886b1ececb8b021b7ef8f7c09cf6b21704566de5e3e5ecf864ddcaf6ae03adeca91fc9405a2b6bf590128ec3e4a18
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [1.2.0]
2
+
3
+ - Updates rubocop-performance from 1.18.0 to 1.19.0
4
+ - Leaves the new rule MapMethodChain disabled.
5
+
6
+ ## [1.1.2]
7
+
8
+ - Fix inheritance of YAML files when specifying an unsupported Ruby
9
+ [#11](https://github.com/standardrb/standard-performance/issues/11)
10
+
1
11
  ## [1.1.1]
2
12
 
3
13
  - Preserve metadata from rubocop-performance by merging it
data/Gemfile CHANGED
@@ -5,3 +5,8 @@ gem "rake"
5
5
  gem "minitest"
6
6
  gem "standard"
7
7
  gem "m"
8
+
9
+ # Remove branch after 2.7 is dropped
10
+ if RUBY_VERSION > "3"
11
+ gem "mocktail"
12
+ end
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- standard-performance (1.1.1)
4
+ standard-performance (1.2.0)
5
5
  lint_roller (~> 1.1)
6
- rubocop-performance (~> 1.18.0)
6
+ rubocop-performance (~> 1.19.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -16,7 +16,8 @@ GEM
16
16
  method_source (>= 0.6.7)
17
17
  rake (>= 0.9.2.2)
18
18
  method_source (1.0.0)
19
- minitest (5.18.1)
19
+ minitest (5.19.0)
20
+ mocktail (1.2.2)
20
21
  parallel (1.23.0)
21
22
  parser (3.2.2.3)
22
23
  ast (~> 2.4.1)
@@ -25,7 +26,7 @@ GEM
25
26
  rainbow (3.1.1)
26
27
  rake (13.0.6)
27
28
  regexp_parser (2.8.1)
28
- rexml (3.2.5)
29
+ rexml (3.2.6)
29
30
  rubocop (1.52.1)
30
31
  json (~> 2.3)
31
32
  parallel (~> 1.10)
@@ -38,18 +39,19 @@ GEM
38
39
  unicode-display_width (>= 2.4.0, < 3.0)
39
40
  rubocop-ast (1.29.0)
40
41
  parser (>= 3.2.1.0)
41
- rubocop-performance (1.18.0)
42
+ rubocop-performance (1.19.0)
42
43
  rubocop (>= 1.7.0, < 2.0)
43
44
  rubocop-ast (>= 0.4.0)
44
45
  ruby-progressbar (1.13.0)
45
- standard (1.30.0)
46
+ standard (1.30.1)
46
47
  language_server-protocol (~> 3.17.0.2)
47
48
  lint_roller (~> 1.0)
48
49
  rubocop (~> 1.52.0)
49
50
  standard-custom (~> 1.0.0)
50
51
  standard-performance (~> 1.1.0)
51
- standard-custom (1.0.1)
52
+ standard-custom (1.0.2)
52
53
  lint_roller (~> 1.0)
54
+ rubocop (~> 1.50)
53
55
  unicode-display_width (2.4.2)
54
56
 
55
57
  PLATFORMS
@@ -60,6 +62,7 @@ PLATFORMS
60
62
  DEPENDENCIES
61
63
  m
62
64
  minitest
65
+ mocktail
63
66
  rake
64
67
  standard
65
68
  standard-performance!
data/config/base.yml CHANGED
@@ -72,6 +72,9 @@ Performance/IoReadlines:
72
72
  Performance/MapCompact:
73
73
  Enabled: false
74
74
 
75
+ Performance/MapMethodChain:
76
+ Enabled: false
77
+
75
78
  Performance/MethodObjectAsBlock:
76
79
  Enabled: false
77
80
 
@@ -0,0 +1,21 @@
1
+ require_relative "determines_yaml_path"
2
+ require_relative "loads_yaml_with_inheritance"
3
+
4
+ module Standard
5
+ module Performance
6
+ class BuildsRuleset
7
+ def initialize
8
+ @determines_yaml_path = DeterminesYamlPath.new
9
+ @loads_yaml_with_inheritance = LoadsYamlWithInheritance.new
10
+ @merges_upstream_metadata = LintRoller::Support::MergesUpstreamMetadata.new
11
+ end
12
+
13
+ def build(target_ruby_version)
14
+ @merges_upstream_metadata.merge(
15
+ @loads_yaml_with_inheritance.load(@determines_yaml_path.determine(target_ruby_version)),
16
+ @loads_yaml_with_inheritance.load(Pathname.new(Gem.loaded_specs["rubocop-performance"].full_gem_path).join("config/default.yml"))
17
+ )
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,31 @@
1
+ require "yaml"
2
+
3
+ module Standard
4
+ module Performance
5
+ class LoadsYamlWithInheritance
6
+ def load(path)
7
+ yaml = YAML.load_file(path)
8
+ if (parent_path = yaml.delete("inherit_from"))
9
+ base_path = File.dirname(path)
10
+ parent_yaml = load(File.join(base_path, parent_path))
11
+
12
+ two_layer_merge(parent_yaml, yaml)
13
+ else
14
+ yaml
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def two_layer_merge(parent, base)
21
+ parent.merge(base) do |key, parent_value, base_value|
22
+ if parent_value.is_a?(Hash) && base_value.is_a?(Hash)
23
+ parent_value.merge(base_value)
24
+ else
25
+ base_value
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,11 +1,10 @@
1
- require_relative "determines_yaml_path"
1
+ require_relative "builds_ruleset"
2
2
 
3
3
  module Standard::Performance
4
4
  class Plugin < LintRoller::Plugin
5
5
  def initialize(config)
6
6
  @config = config
7
- @merges_upstream_metadata = LintRoller::Support::MergesUpstreamMetadata.new
8
- @determines_yaml_path = DeterminesYamlPath.new
7
+ @builds_ruleset = BuildsRuleset.new
9
8
  end
10
9
 
11
10
  def about
@@ -24,15 +23,10 @@ module Standard::Performance
24
23
  def rules(context)
25
24
  trick_rubocop_into_thinking_we_required_rubocop_performance!
26
25
 
27
- rules = @merges_upstream_metadata.merge(
28
- YAML.load_file(@determines_yaml_path.determine(context.target_ruby_version)),
29
- YAML.load_file(Pathname.new(Gem.loaded_specs["rubocop-performance"].full_gem_path).join("config/default.yml"))
30
- )
31
-
32
26
  LintRoller::Rules.new(
33
27
  type: :object,
34
28
  config_format: :rubocop,
35
- value: rules
29
+ value: @builds_ruleset.build(context.target_ruby_version)
36
30
  )
37
31
  end
38
32
 
@@ -1,5 +1,5 @@
1
1
  module Standard
2
2
  module Performance
3
- VERSION = "1.1.1"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard-performance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
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-07-07 00:00:00.000000000 Z
11
+ date: 2023-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lint_roller
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.18.0
33
+ version: 1.19.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.18.0
40
+ version: 1.19.0
41
41
  description:
42
42
  email:
43
43
  - searls@gmail.com
@@ -61,7 +61,9 @@ files:
61
61
  - docs/RELEASE.md
62
62
  - lib/standard-performance.rb
63
63
  - lib/standard/performance.rb
64
+ - lib/standard/performance/builds_ruleset.rb
64
65
  - lib/standard/performance/determines_yaml_path.rb
66
+ - lib/standard/performance/loads_yaml_with_inheritance.rb
65
67
  - lib/standard/performance/plugin.rb
66
68
  - lib/standard/performance/version.rb
67
69
  homepage: https://github.com/standardrb/standard-performance
@@ -80,14 +82,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
80
82
  requirements:
81
83
  - - ">="
82
84
  - !ruby/object:Gem::Version
83
- version: 2.6.0
85
+ version: 2.7.0
84
86
  required_rubygems_version: !ruby/object:Gem::Requirement
85
87
  requirements:
86
88
  - - ">="
87
89
  - !ruby/object:Gem::Version
88
90
  version: '0'
89
91
  requirements: []
90
- rubygems_version: 3.4.14
92
+ rubygems_version: 3.2.15
91
93
  signing_key:
92
94
  specification_version: 4
93
95
  summary: Standard Ruby Plugin providing configuration for rubocop-performance