standard-performance 1.1.1 → 1.1.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 +5 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +3 -1
- data/lib/standard/performance/builds_ruleset.rb +21 -0
- data/lib/standard/performance/loads_yaml_with_inheritance.rb +31 -0
- data/lib/standard/performance/plugin.rb +3 -9
- data/lib/standard/performance/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 930070f7d659e1940012562f63b84b5ed14c00c3e35d3d7e06319d0a9be44f21
|
4
|
+
data.tar.gz: cf9d413e889ff09bf457903083f807bfe4f9c91e920024db8ba6fb70fbc5be8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 516ddf177823b318787c6522f36a88e9321bab42c3965cbcf6283549fddab75ae8073615d4044788110e9aadeac61a0ce842a959b33a20ec6a27f73f9eda2050
|
7
|
+
data.tar.gz: 8d23940d46563584f6c24870f1483c724fe94efb9d46555a0c602c2f592e8730702060cd9cb0d970b8a4f5e5650433c0f789448a6d91dd694bee69583eda7021
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
standard-performance (1.1.
|
4
|
+
standard-performance (1.1.2)
|
5
5
|
lint_roller (~> 1.1)
|
6
6
|
rubocop-performance (~> 1.18.0)
|
7
7
|
|
@@ -17,6 +17,7 @@ GEM
|
|
17
17
|
rake (>= 0.9.2.2)
|
18
18
|
method_source (1.0.0)
|
19
19
|
minitest (5.18.1)
|
20
|
+
mocktail (1.2.2)
|
20
21
|
parallel (1.23.0)
|
21
22
|
parser (3.2.2.3)
|
22
23
|
ast (~> 2.4.1)
|
@@ -60,6 +61,7 @@ PLATFORMS
|
|
60
61
|
DEPENDENCIES
|
61
62
|
m
|
62
63
|
minitest
|
64
|
+
mocktail
|
63
65
|
rake
|
64
66
|
standard
|
65
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,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 "
|
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
|
-
@
|
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:
|
29
|
+
value: @builds_ruleset.build(context.target_ruby_version)
|
36
30
|
)
|
37
31
|
end
|
38
32
|
|
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.
|
4
|
+
version: 1.1.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-07-
|
11
|
+
date: 2023-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lint_roller
|
@@ -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,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
82
|
requirements:
|
81
83
|
- - ">="
|
82
84
|
- !ruby/object:Gem::Version
|
83
|
-
version: 2.
|
85
|
+
version: 2.7.0
|
84
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
87
|
requirements:
|
86
88
|
- - ">="
|