standard-performance 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 23048433c69f45dac01b8b01b285c082057bbf298881d917eeca5ab3ede9d799
4
+ data.tar.gz: e98436b3aa86cbc7592da6ca72079763a4e2af673e811517cd3454c307d46609
5
+ SHA512:
6
+ metadata.gz: 951d2d0842df9094215a0ce85e594300bdcfd8290aba993abeab9a95015007829580fb437e11cb029a2c9a69b50db312287b5d62f774425a3ed19ae59e287c06
7
+ data.tar.gz: '09473cdf55509bd401ac62c023091b869c03e355e6129729eefbb9a2e6e44e56547f03e7872140443bf3b9a2fb7281e2d0c9c905399c11d321139031a7c48cb0'
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/testdouble/standard
3
+ ruby_version: 2.6
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [1.0.0]
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+ gem "rake"
5
+ gem "minitest"
6
+ gem "standard"
7
+ gem "m"
8
+
9
+ group :test do
10
+ gem "rubocop", "~> 1.48.1"
11
+ end
12
+
13
+ gem "lint_roller", path: "../lint_roller"
data/Gemfile.lock ADDED
@@ -0,0 +1,66 @@
1
+ PATH
2
+ remote: ../lint_roller
3
+ specs:
4
+ lint_roller (1.0.0)
5
+
6
+ PATH
7
+ remote: .
8
+ specs:
9
+ standard-performance (1.0.0)
10
+ lint_roller (~> 1.0)
11
+ rubocop-performance (~> 1.16.0)
12
+
13
+ GEM
14
+ remote: https://rubygems.org/
15
+ specs:
16
+ ast (2.4.2)
17
+ json (2.6.3)
18
+ language_server-protocol (3.17.0.3)
19
+ m (1.6.1)
20
+ method_source (>= 0.6.7)
21
+ rake (>= 0.9.2.2)
22
+ method_source (1.0.0)
23
+ minitest (5.18.0)
24
+ parallel (1.22.1)
25
+ parser (3.2.2.0)
26
+ ast (~> 2.4.1)
27
+ rainbow (3.1.1)
28
+ rake (13.0.6)
29
+ regexp_parser (2.7.0)
30
+ rexml (3.2.5)
31
+ rubocop (1.48.1)
32
+ json (~> 2.3)
33
+ parallel (~> 1.10)
34
+ parser (>= 3.2.0.0)
35
+ rainbow (>= 2.2.2, < 4.0)
36
+ regexp_parser (>= 1.8, < 3.0)
37
+ rexml (>= 3.2.5, < 4.0)
38
+ rubocop-ast (>= 1.26.0, < 2.0)
39
+ ruby-progressbar (~> 1.7)
40
+ unicode-display_width (>= 2.4.0, < 3.0)
41
+ rubocop-ast (1.28.0)
42
+ parser (>= 3.2.1.0)
43
+ rubocop-performance (1.16.0)
44
+ rubocop (>= 1.7.0, < 2.0)
45
+ rubocop-ast (>= 0.4.0)
46
+ ruby-progressbar (1.13.0)
47
+ standard (1.26.0)
48
+ language_server-protocol (~> 3.17.0.2)
49
+ rubocop (~> 1.48.1)
50
+ rubocop-performance (~> 1.16.0)
51
+ unicode-display_width (2.4.2)
52
+
53
+ PLATFORMS
54
+ arm64-darwin-22
55
+
56
+ DEPENDENCIES
57
+ lint_roller!
58
+ m
59
+ minitest
60
+ rake
61
+ rubocop (~> 1.48.1)
62
+ standard
63
+ standard-performance!
64
+
65
+ BUNDLED WITH
66
+ 2.4.10
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Test Double, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # standard-performance
2
+
3
+ This gem provides a [lint_roller](https://github.com/standardrb/lint_roller)
4
+ plugin configuration for the
5
+ [rubocop-performance](https://github.com/rubocop/rubocop-performance) ruleset.
6
+ It, along with [standard-custom](https://github.com/standardrb/standard-custom),
7
+ is configured by default by the [Standard Ruby
8
+ gem](https://github.com/standardrb/standard)
9
+
10
+ In general, if you're using Standard, you won't need to install or configure
11
+ this gem manually, so there's not much to cover in this README!
12
+
13
+ ## Code of Conduct
14
+
15
+ This project follows Test Double's [code of
16
+ conduct](https://testdouble.com/code-of-conduct) for all community interactions,
17
+ including (but not limited to) one-on-one communications, public posts/comments,
18
+ code reviews, pull requests, and GitHub issues. If violations occur, Test Double
19
+ will take any action they deem appropriate for the infraction, up to and
20
+ including blocking a user from the organization's repositories.
21
+
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ require "standard/rake"
11
+
12
+ task default: %i[test standard:fix]
data/config/base.yml ADDED
@@ -0,0 +1,149 @@
1
+ Performance/AncestorsInclude:
2
+ Enabled: false
3
+
4
+ Performance/ArraySemiInfiniteRangeSlice:
5
+ Enabled: false
6
+
7
+ Performance/BigDecimalWithNumericArgument:
8
+ Enabled: true
9
+
10
+ Performance/BindCall:
11
+ Enabled: true
12
+
13
+ Performance/BlockGivenWithExplicitBlock:
14
+ Enabled: true
15
+
16
+ Performance/Caller:
17
+ Enabled: true
18
+
19
+ Performance/CaseWhenSplat:
20
+ Enabled: false
21
+
22
+ Performance/Casecmp:
23
+ Enabled: false
24
+
25
+ Performance/ChainArrayAllocation:
26
+ Enabled: false
27
+
28
+ Performance/CollectionLiteralInLoop:
29
+ Enabled: false
30
+
31
+ Performance/CompareWithBlock:
32
+ Enabled: true
33
+
34
+ Performance/ConcurrentMonotonicTime:
35
+ Enabled: true
36
+
37
+ Performance/ConstantRegexp:
38
+ Enabled: true
39
+
40
+ Performance/Count:
41
+ Enabled: true
42
+
43
+ Performance/DeletePrefix:
44
+ Enabled: false
45
+
46
+ Performance/DeleteSuffix:
47
+ Enabled: false
48
+
49
+ Performance/Detect:
50
+ Enabled: true
51
+
52
+ Performance/DoubleStartEndWith:
53
+ Enabled: true
54
+ IncludeActiveSupportAliases: false
55
+
56
+ Performance/EndWith:
57
+ Enabled: true
58
+
59
+ Performance/FixedSize:
60
+ Enabled: true
61
+
62
+ Performance/FlatMap:
63
+ Enabled: true
64
+ EnabledForFlattenWithoutParams: false
65
+
66
+ Performance/InefficientHashSearch:
67
+ Enabled: true
68
+
69
+ Performance/IoReadlines:
70
+ Enabled: false
71
+
72
+ Performance/MapCompact:
73
+ Enabled: false
74
+
75
+ Performance/MethodObjectAsBlock:
76
+ Enabled: false
77
+
78
+ Performance/OpenStruct:
79
+ Enabled: false
80
+
81
+ Performance/RangeInclude:
82
+ Enabled: true
83
+
84
+ Performance/RedundantBlockCall:
85
+ Enabled: false
86
+
87
+ Performance/RedundantEqualityComparisonBlock:
88
+ Enabled: false
89
+
90
+ Performance/RedundantMatch:
91
+ Enabled: true
92
+
93
+ Performance/RedundantMerge:
94
+ Enabled: true
95
+ MaxKeyValuePairs: 2
96
+
97
+ Performance/RedundantSortBlock:
98
+ Enabled: true
99
+
100
+ Performance/RedundantSplitRegexpArgument:
101
+ Enabled: true
102
+
103
+ Performance/RedundantStringChars:
104
+ Enabled: true
105
+
106
+ Performance/RegexpMatch:
107
+ Enabled: true
108
+
109
+ Performance/ReverseEach:
110
+ Enabled: true
111
+
112
+ Performance/ReverseFirst:
113
+ Enabled: true
114
+
115
+ Performance/SelectMap:
116
+ Enabled: false
117
+
118
+ Performance/Size:
119
+ Enabled: true
120
+
121
+ Performance/SortReverse:
122
+ Enabled: true
123
+
124
+ Performance/Squeeze:
125
+ Enabled: true
126
+
127
+ Performance/StartWith:
128
+ Enabled: true
129
+
130
+ Performance/StringIdentifierArgument:
131
+ Enabled: true
132
+
133
+ Performance/StringInclude:
134
+ Enabled: false
135
+
136
+ Performance/StringReplacement:
137
+ Enabled: true
138
+
139
+ Performance/Sum:
140
+ Enabled: false
141
+
142
+ Performance/TimesMap:
143
+ Enabled: false
144
+
145
+ Performance/UnfreezeString:
146
+ Enabled: true
147
+
148
+ Performance/UriDefaultParser:
149
+ Enabled: true
@@ -0,0 +1,4 @@
1
+ inherit_from: ./base.yml
2
+
3
+ Performance/ConcurrentMonotonicTime:
4
+ Enabled: false
@@ -0,0 +1,65 @@
1
+ module Standard::Performance
2
+ class Plugin < LintRoller::Plugin
3
+ def initialize(config)
4
+ @config = config
5
+ end
6
+
7
+ def about
8
+ LintRoller::About.new(
9
+ name: "standard-performance",
10
+ version: VERSION,
11
+ homepage: "https://github.com/testdouble/standard-performance",
12
+ description: "Configuration for rubocop-performance's rules"
13
+ )
14
+ end
15
+
16
+ def supported?(context)
17
+ true
18
+ end
19
+
20
+ def rules(context)
21
+ trick_rubocop_into_thinking_we_required_rubocop_performance!
22
+
23
+ LintRoller::Rules.new(
24
+ type: :path,
25
+ config_format: :rubocop,
26
+ value: determine_yaml_path(context.target_ruby_version)
27
+ )
28
+ end
29
+
30
+ private
31
+
32
+ # This is not fantastic.
33
+ #
34
+ # When you `require "rubocop-performance"`, it will not only load the cops,
35
+ # but it will also monkey-patch RuboCop's default_configuration, which is
36
+ # something that can't be undone for the lifetime of the process.
37
+ #
38
+ # See: https://github.com/rubocop/rubocop-performance/commit/587050a8c0ec6d2fa64f5be970425a7f4c5d779b
39
+ #
40
+ # As an alternative, standard-performance loads the cops directly, and then
41
+ # simply tells the RuboCop config loader that it's been loaded. This is
42
+ # taking advantage of a private API of an `attr_reader` that probably wasn't
43
+ # meant to be mutated externally, but it's better than the `Inject` monkey
44
+ # patching that rubocop-performance does (and many other RuboCop plugins do)
45
+ def trick_rubocop_into_thinking_we_required_rubocop_performance!
46
+ require "rubocop"
47
+ require "rubocop/cop/performance_cops"
48
+ RuboCop::ConfigLoader.default_configuration.loaded_features.add("rubocop-performance")
49
+ end
50
+
51
+ def determine_yaml_path(desired_version)
52
+ default = "base.yml"
53
+
54
+ file_name = if !Gem::Version.correct?(desired_version)
55
+ default
56
+ elsif desired_version < Gem::Version.new("2.3")
57
+ "ruby-2.2.yml"
58
+ else
59
+ default
60
+ end
61
+
62
+ Pathname.new(__dir__).join("../../../config/#{file_name}")
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,5 @@
1
+ module Standard
2
+ module Performance
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ require "lint_roller"
2
+
3
+ require_relative "performance/version"
4
+ require_relative "performance/plugin"
5
+
6
+ module Standard
7
+ module Performance
8
+ end
9
+ end
@@ -0,0 +1 @@
1
+ require_relative "standard/performance"
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: standard-performance
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Justin Searls
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-04-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: lint_roller
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop-performance
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.16.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.16.0
41
+ description:
42
+ email:
43
+ - searls@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".standard.yml"
49
+ - CHANGELOG.md
50
+ - Gemfile
51
+ - Gemfile.lock
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - config/base.yml
56
+ - config/ruby-2.2.yml
57
+ - lib/standard-performance.rb
58
+ - lib/standard/performance.rb
59
+ - lib/standard/performance/plugin.rb
60
+ - lib/standard/performance/version.rb
61
+ homepage: https://github.com/standardrb/standard-performance
62
+ licenses:
63
+ - MIT
64
+ metadata:
65
+ homepage_uri: https://github.com/standardrb/standard-performance
66
+ source_code_uri: https://github.com/standardrb/standard-performance
67
+ changelog_uri: https://github.com/standardrb/standard-performance/blob/main/CHANGELOG.md
68
+ default_lint_roller_plugin: Standard::Performance::Plugin
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: 2.6.0
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubygems_version: 3.4.10
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: Standard Ruby Plugin providing configuration for rubocop-performance
88
+ test_files: []