standard-performance 1.1.0 → 1.1.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: 1bae992bcc9fe9ebfe27b0fa39731373d07c9fa4eb60ca6d5114c3a2d20bb152
4
- data.tar.gz: bdc0203b28a41368821a1dcab79bb6da9dbf4e1885f9f37536158082117ed223
3
+ metadata.gz: 930070f7d659e1940012562f63b84b5ed14c00c3e35d3d7e06319d0a9be44f21
4
+ data.tar.gz: cf9d413e889ff09bf457903083f807bfe4f9c91e920024db8ba6fb70fbc5be8f
5
5
  SHA512:
6
- metadata.gz: d1bd85a254885e8850d2b22fdde747c47ec8e31685d9325e0e030cd41b4e2e69389ce684bc667e30b3f96c26598fdbaad4642b0a0b333fd49b668dfc4ec5a738
7
- data.tar.gz: e3187abc3f81b1e20d7a2c6c2e0e312400946dbedc2424e5a98c579d12a79cad6acd77acf1b69a0f69c277c603de900bf4e15b0564f7cb6d6d80ea8f3f3c6474
6
+ metadata.gz: 516ddf177823b318787c6522f36a88e9321bab42c3965cbcf6283549fddab75ae8073615d4044788110e9aadeac61a0ce842a959b33a20ec6a27f73f9eda2050
7
+ data.tar.gz: 8d23940d46563584f6c24870f1483c724fe94efb9d46555a0c602c2f592e8730702060cd9cb0d970b8a4f5e5650433c0f789448a6d91dd694bee69583eda7021
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [1.1.2]
2
+
3
+ - Fix inheritance of YAML files when specifying an unsupported Ruby
4
+ [standard#573](https://github.com/standardrb/standard/issues/573)
5
+
6
+ ## [1.1.1]
7
+
8
+ - Preserve metadata from rubocop-performance by merging it
9
+
1
10
  ## [1.1.0]
2
11
 
3
12
  - Updates rubocop-performance from 1.16.0 to 1.18.0
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ gem "rake"
5
5
  gem "minitest"
6
6
  gem "standard"
7
7
  gem "m"
8
+ gem "mocktail"
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- standard-performance (1.1.0)
5
- lint_roller (~> 1.0)
4
+ standard-performance (1.1.2)
5
+ lint_roller (~> 1.1)
6
6
  rubocop-performance (~> 1.18.0)
7
7
 
8
8
  GEM
@@ -11,23 +11,26 @@ GEM
11
11
  ast (2.4.2)
12
12
  json (2.6.3)
13
13
  language_server-protocol (3.17.0.3)
14
- lint_roller (1.0.0)
14
+ lint_roller (1.1.0)
15
15
  m (1.6.1)
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.0)
19
+ minitest (5.18.1)
20
+ mocktail (1.2.2)
20
21
  parallel (1.23.0)
21
- parser (3.2.2.1)
22
+ parser (3.2.2.3)
22
23
  ast (~> 2.4.1)
24
+ racc
25
+ racc (1.7.1)
23
26
  rainbow (3.1.1)
24
27
  rake (13.0.6)
25
- regexp_parser (2.8.0)
28
+ regexp_parser (2.8.1)
26
29
  rexml (3.2.5)
27
- rubocop (1.50.2)
30
+ rubocop (1.52.1)
28
31
  json (~> 2.3)
29
32
  parallel (~> 1.10)
30
- parser (>= 3.2.0.0)
33
+ parser (>= 3.2.2.3)
31
34
  rainbow (>= 2.2.2, < 4.0)
32
35
  regexp_parser (>= 1.8, < 3.0)
33
36
  rexml (>= 3.2.5, < 4.0)
@@ -40,13 +43,13 @@ GEM
40
43
  rubocop (>= 1.7.0, < 2.0)
41
44
  rubocop-ast (>= 0.4.0)
42
45
  ruby-progressbar (1.13.0)
43
- standard (1.28.5)
46
+ standard (1.30.0)
44
47
  language_server-protocol (~> 3.17.0.2)
45
48
  lint_roller (~> 1.0)
46
- rubocop (~> 1.50.2)
49
+ rubocop (~> 1.52.0)
47
50
  standard-custom (~> 1.0.0)
48
- standard-performance (~> 1.0.1)
49
- standard-custom (1.0.0)
51
+ standard-performance (~> 1.1.0)
52
+ standard-custom (1.0.1)
50
53
  lint_roller (~> 1.0)
51
54
  unicode-display_width (2.4.2)
52
55
 
@@ -58,6 +61,7 @@ PLATFORMS
58
61
  DEPENDENCIES
59
62
  m
60
63
  minitest
64
+ mocktail
61
65
  rake
62
66
  standard
63
67
  standard-performance!
@@ -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,28 @@
1
+ module Standard
2
+ module Performance
3
+ class DeterminesYamlPath
4
+ def determine(desired_version)
5
+ desired_version = Gem::Version.new(desired_version) unless desired_version.is_a?(Gem::Version)
6
+ default = "base.yml"
7
+
8
+ file_name = if !Gem::Version.correct?(desired_version)
9
+ default
10
+ elsif desired_version < Gem::Version.new("1.9")
11
+ "ruby-1.8.yml"
12
+ elsif desired_version < Gem::Version.new("2.0")
13
+ "ruby-1.9.yml"
14
+ elsif desired_version < Gem::Version.new("2.1")
15
+ "ruby-2.0.yml"
16
+ elsif desired_version < Gem::Version.new("2.2")
17
+ "ruby-2.1.yml"
18
+ elsif desired_version < Gem::Version.new("2.3")
19
+ "ruby-2.2.yml"
20
+ else
21
+ default
22
+ end
23
+
24
+ Pathname.new(__dir__).join("../../../config/#{file_name}")
25
+ end
26
+ end
27
+ end
28
+ 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,7 +1,10 @@
1
+ require_relative "builds_ruleset"
2
+
1
3
  module Standard::Performance
2
4
  class Plugin < LintRoller::Plugin
3
5
  def initialize(config)
4
6
  @config = config
7
+ @builds_ruleset = BuildsRuleset.new
5
8
  end
6
9
 
7
10
  def about
@@ -21,9 +24,9 @@ module Standard::Performance
21
24
  trick_rubocop_into_thinking_we_required_rubocop_performance!
22
25
 
23
26
  LintRoller::Rules.new(
24
- type: :path,
27
+ type: :object,
25
28
  config_format: :rubocop,
26
- value: determine_yaml_path(context.target_ruby_version)
29
+ value: @builds_ruleset.build(context.target_ruby_version)
27
30
  )
28
31
  end
29
32
 
@@ -47,28 +50,5 @@ module Standard::Performance
47
50
  require "rubocop/cop/performance_cops"
48
51
  RuboCop::ConfigLoader.default_configuration.loaded_features.add("rubocop-performance")
49
52
  end
50
-
51
- def determine_yaml_path(desired_version)
52
- desired_version = Gem::Version.new(desired_version) unless desired_version.is_a?(Gem::Version)
53
- default = "base.yml"
54
-
55
- file_name = if !Gem::Version.correct?(desired_version)
56
- default
57
- elsif desired_version < Gem::Version.new("1.9")
58
- "ruby-1.8.yml"
59
- elsif desired_version < Gem::Version.new("2.0")
60
- "ruby-1.9.yml"
61
- elsif desired_version < Gem::Version.new("2.1")
62
- "ruby-2.0.yml"
63
- elsif desired_version < Gem::Version.new("2.2")
64
- "ruby-2.1.yml"
65
- elsif desired_version < Gem::Version.new("2.3")
66
- "ruby-2.2.yml"
67
- else
68
- default
69
- end
70
-
71
- Pathname.new(__dir__).join("../../../config/#{file_name}")
72
- end
73
53
  end
74
54
  end
@@ -1,5 +1,5 @@
1
1
  module Standard
2
2
  module Performance
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.2"
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.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-02 00:00:00.000000000 Z
11
+ date: 2023-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lint_roller
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '1.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '1.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubocop-performance
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.18.0
41
- description:
41
+ description:
42
42
  email:
43
43
  - searls@gmail.com
44
44
  executables: []
@@ -61,6 +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
65
+ - lib/standard/performance/determines_yaml_path.rb
66
+ - lib/standard/performance/loads_yaml_with_inheritance.rb
64
67
  - lib/standard/performance/plugin.rb
65
68
  - lib/standard/performance/version.rb
66
69
  homepage: https://github.com/standardrb/standard-performance
@@ -71,7 +74,7 @@ metadata:
71
74
  source_code_uri: https://github.com/standardrb/standard-performance
72
75
  changelog_uri: https://github.com/standardrb/standard-performance/blob/main/CHANGELOG.md
73
76
  default_lint_roller_plugin: Standard::Performance::Plugin
74
- post_install_message:
77
+ post_install_message:
75
78
  rdoc_options: []
76
79
  require_paths:
77
80
  - lib
@@ -79,15 +82,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
79
82
  requirements:
80
83
  - - ">="
81
84
  - !ruby/object:Gem::Version
82
- version: 2.6.0
85
+ version: 2.7.0
83
86
  required_rubygems_version: !ruby/object:Gem::Requirement
84
87
  requirements:
85
88
  - - ">="
86
89
  - !ruby/object:Gem::Version
87
90
  version: '0'
88
91
  requirements: []
89
- rubygems_version: 3.1.6
90
- signing_key:
92
+ rubygems_version: 3.4.14
93
+ signing_key:
91
94
  specification_version: 4
92
95
  summary: Standard Ruby Plugin providing configuration for rubocop-performance
93
96
  test_files: []