radius-spec 0.7.0 → 0.8.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 +4 -4
- data/.github/workflows/ci.yml +28 -0
- data/.github/workflows/reviewdog.yml +21 -0
- data/.rubocop.yml +6 -6
- data/CHANGELOG.md +29 -4
- data/Gemfile +1 -3
- data/README.md +5 -6
- data/benchmarks/call_vs_yield.rb +0 -2
- data/benchmarks/cover_vs_include.rb +2 -2
- data/benchmarks/format_string.rb +3 -3
- data/benchmarks/hash_each.rb +305 -0
- data/benchmarks/hash_merge.rb +1 -1
- data/benchmarks/hash_transform.rb +455 -0
- data/benchmarks/unfreeze_string.rb +0 -2
- data/common_rubocop.yml +54 -41
- data/common_rubocop_rails.yml +33 -9
- data/lib/radius/spec/model_factory.rb +0 -2
- data/lib/radius/spec/vcr.rb +0 -2
- data/lib/radius/spec/version.rb +1 -1
- data/radius-spec.gemspec +6 -6
- metadata +12 -10
- data/.travis.yml +0 -15
- data/bin/ci-code-review +0 -28
@@ -5,7 +5,6 @@ require_relative 'bm_setup'
|
|
5
5
|
|
6
6
|
display_benchmark_header
|
7
7
|
|
8
|
-
# rubocop:disable Performance/UnfreezeString
|
9
8
|
section "Unfreezing empty string" do |bench|
|
10
9
|
bench.report("String.new") do
|
11
10
|
String.new
|
@@ -34,7 +33,6 @@ section "Unfreezing string" do |bench|
|
|
34
33
|
STRING.dup
|
35
34
|
end
|
36
35
|
end
|
37
|
-
# rubocop:enable Performance/UnfreezeString
|
38
36
|
|
39
37
|
__END__
|
40
38
|
|
data/common_rubocop.yml
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
AllCops:
|
2
2
|
TargetRubyVersion: 2.7.0
|
3
|
+
# We choose to opt-in to new checks by default. This allows us to update
|
4
|
+
# version by version without having to worry about adding an entry for each
|
5
|
+
# new "enabled by default" check. If we want to jump multiple versions and
|
6
|
+
# wish to be notified of all the enw check, then we'll need to change
|
7
|
+
# `NewCops` to `pending.
|
8
|
+
NewCops: enable
|
3
9
|
Exclude:
|
4
10
|
# Exclude generated binstubs
|
5
11
|
- 'bin/bundle'
|
@@ -56,7 +62,7 @@ Layout/AccessModifierIndentation:
|
|
56
62
|
# SupportedHashRocketStyles: key, separator, table
|
57
63
|
# SupportedColonStyles: key, separator, table
|
58
64
|
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
59
|
-
Layout/
|
65
|
+
Layout/HashAlignment:
|
60
66
|
Enabled: true
|
61
67
|
EnforcedHashRocketStyle: key
|
62
68
|
EnforcedColonStyle: key
|
@@ -82,7 +88,7 @@ Layout/BlockAlignment:
|
|
82
88
|
#
|
83
89
|
# TODO: At some point this is split into both Layout/FirstArgumentIndentation
|
84
90
|
# and Layout/FirstParameterIndentation
|
85
|
-
Layout/
|
91
|
+
Layout/FirstArgumentIndentation:
|
86
92
|
Enabled: false
|
87
93
|
|
88
94
|
# This project only uses newer Ruby versions which all support the "squiggly"
|
@@ -91,9 +97,44 @@ Layout/IndentFirstArgument:
|
|
91
97
|
#
|
92
98
|
# Configuration parameters: EnforcedStyle.
|
93
99
|
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
|
94
|
-
Layout/
|
100
|
+
Layout/HeredocIndentation:
|
95
101
|
EnforcedStyle: squiggly
|
96
102
|
|
103
|
+
# We generally prefer to use the default line length of 80. Though sometimes
|
104
|
+
# we just need a little extra space because it makes it easier to read.
|
105
|
+
#
|
106
|
+
# The only way to disable Rubocop for a single line is either to wrap the line
|
107
|
+
# with two comments or append the disable comment to the end of the line. For
|
108
|
+
# guard clauses, we tend to prefer trailing comments to avoid adding two lines
|
109
|
+
# just to disable a cop on one line.
|
110
|
+
#
|
111
|
+
# Sometimes comments include ASCII diagrams, flow charts, etc. These cannot
|
112
|
+
# always be reformatted to fit within the 80 column limit. Also, we write most
|
113
|
+
# comments in markdown format. Rubocop isn't very good at understanding when
|
114
|
+
# the line is long because of a URL in a markdown link. Instead of requiring
|
115
|
+
# additional comments to turn this cop off for comments we ignore any long
|
116
|
+
# lines which are only comments.
|
117
|
+
#
|
118
|
+
# There are also cases where for one valid reason or another we have a trailing
|
119
|
+
# comment that extends a little too far. We'd like to be able to ignore those
|
120
|
+
# as well. This _attempts_ to do that, however, as this uses simple regular
|
121
|
+
# expressions we can only attempt to match so much. We probably should change
|
122
|
+
# this for a node pattern matcher in the future.
|
123
|
+
#
|
124
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes,
|
125
|
+
# IgnoreCopDirectives, IgnoredPatterns.
|
126
|
+
# URISchemes: http, https
|
127
|
+
Layout/LineLength:
|
128
|
+
IgnoreCopDirectives: true
|
129
|
+
IgnoredPatterns:
|
130
|
+
# Leading comments
|
131
|
+
- '\A\s*#'
|
132
|
+
# Attempt at trailing comments
|
133
|
+
- '\A.{1,78}\s#\s.*\z'
|
134
|
+
Max: 100
|
135
|
+
Exclude:
|
136
|
+
- '**/*.gemspec'
|
137
|
+
|
97
138
|
# We tend to indent multi-line operation statements. I think this is because it
|
98
139
|
# tends to be the default style auto-formatted by VIM (which many of us use).
|
99
140
|
# It also helps show the continuation of the statement instead of it
|
@@ -186,41 +227,6 @@ Metrics/BlockLength:
|
|
186
227
|
- 'RSpec.configure'
|
187
228
|
- 'VCR.configure'
|
188
229
|
|
189
|
-
# We generally prefer to use the default line length of 80. Though sometimes
|
190
|
-
# we just need a little extra space because it makes it easier to read.
|
191
|
-
#
|
192
|
-
# The only way to disable Rubocop for a single line is either to wrap the line
|
193
|
-
# with two comments or append the disable comment to the end of the line. For
|
194
|
-
# guard clauses, we tend to prefer trailing comments to avoid adding two lines
|
195
|
-
# just to disable a cop on one line.
|
196
|
-
#
|
197
|
-
# Sometimes comments include ASCII diagrams, flow charts, etc. These cannot
|
198
|
-
# always be reformatted to fit within the 80 column limit. Also, we write most
|
199
|
-
# comments in markdown format. Rubocop isn't very good at understanding when
|
200
|
-
# the line is long because of a URL in a markdown link. Instead of requiring
|
201
|
-
# additional comments to turn this cop off for comments we ignore any long
|
202
|
-
# lines which are only comments.
|
203
|
-
#
|
204
|
-
# There are also cases where for one valid reason or another we have a trailing
|
205
|
-
# comment that extends a little too far. We'd like to be able to ignore those
|
206
|
-
# as well. This _attempts_ to do that, however, as this uses simple regular
|
207
|
-
# expressions we can only attempt to match so much. We probably should change
|
208
|
-
# this for a node pattern matcher in the future.
|
209
|
-
#
|
210
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes,
|
211
|
-
# IgnoreCopDirectives, IgnoredPatterns.
|
212
|
-
# URISchemes: http, https
|
213
|
-
Metrics/LineLength:
|
214
|
-
IgnoreCopDirectives: true
|
215
|
-
IgnoredPatterns:
|
216
|
-
# Leading comments
|
217
|
-
- '\A\s*#'
|
218
|
-
# Attempt at trailing comments
|
219
|
-
- '\A.{1,78}\s#\s.*\z'
|
220
|
-
Max: 100
|
221
|
-
Exclude:
|
222
|
-
- '**/*.gemspec'
|
223
|
-
|
224
230
|
# TODO: Remove this when we get to 0.89.0 as the new default max is 8
|
225
231
|
#
|
226
232
|
# Configuration parameters: IgnoredMethods, Max
|
@@ -248,14 +254,14 @@ Naming/FileName:
|
|
248
254
|
# `EOF` is a common terminal abbreviate indicating end-of-file. We allow this
|
249
255
|
# for those heredocs which represent "file" text.
|
250
256
|
#
|
251
|
-
# Configuration parameters:
|
252
|
-
#
|
257
|
+
# Configuration parameters: ForbiddenDelimiters.
|
258
|
+
# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
|
253
259
|
Naming/HeredocDelimiterNaming:
|
254
260
|
Details: |
|
255
261
|
|
256
262
|
Use meaningful delimiter names to provide context to the text. The only
|
257
263
|
allowed `EO*` variant if `EOF` which has specific meaning for file content.
|
258
|
-
|
264
|
+
ForbiddenDelimiters:
|
259
265
|
- !ruby/regexp '/(^|\s)(EO[A-EG-Z]{1}|END)(\s|$)/'
|
260
266
|
|
261
267
|
# It is generally a good idea to match the instance variable names with their
|
@@ -454,6 +460,13 @@ Style/EmptyCaseCondition:
|
|
454
460
|
Style/EmptyMethod:
|
455
461
|
EnforcedStyle: expanded
|
456
462
|
|
463
|
+
# Always require the pragma comment to be true
|
464
|
+
#
|
465
|
+
# Configuration parameters: EnforcedStyle.
|
466
|
+
# SupportedStyles: always, always_true, never
|
467
|
+
Style/FrozenStringLiteralComment:
|
468
|
+
EnforcedStyle: always_true
|
469
|
+
|
457
470
|
# Prefer symbol keys using the 1.9 hash syntax. However, when keys are mixed
|
458
471
|
# use a consistent mapping style; which generally means using hash rockets:
|
459
472
|
#
|
data/common_rubocop_rails.yml
CHANGED
@@ -20,26 +20,26 @@ AllCops:
|
|
20
20
|
- 'db/migrate/**/*'
|
21
21
|
|
22
22
|
# Rails project's are not concerned with API docs normally
|
23
|
-
Documentation:
|
23
|
+
Style/Documentation:
|
24
24
|
Enabled: false
|
25
25
|
|
26
|
-
Metrics/BlockLength:
|
27
|
-
Exclude:
|
28
|
-
- 'bin/setup'
|
29
|
-
- 'bin/update'
|
30
|
-
- 'config/routes.rb'
|
31
|
-
- 'spec/rails_helper.rb'
|
32
|
-
|
33
26
|
# Rails foreign keys and indexes can get long. We want to ignore our annotation
|
34
27
|
# comments which are for these entries.
|
35
28
|
#
|
36
29
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
37
30
|
# URISchemes: http, https
|
38
|
-
|
31
|
+
Layout/LineLength:
|
39
32
|
IgnoredPatterns:
|
40
33
|
- '\A# fk_rails_'
|
41
34
|
- '\A# index_'
|
42
35
|
|
36
|
+
Metrics/BlockLength:
|
37
|
+
Exclude:
|
38
|
+
- 'bin/setup'
|
39
|
+
- 'bin/update'
|
40
|
+
- 'config/routes.rb'
|
41
|
+
- 'spec/rails_helper.rb'
|
42
|
+
|
43
43
|
# For our Rails apps several of them use the `respond_to` with `format` blocks
|
44
44
|
# to handle various mime types (mostly HTML and JSON). Given our `do` / `end`
|
45
45
|
# block style for non-functional blocks (which includes both `respond_to` and
|
@@ -150,6 +150,30 @@ Rails/HasAndBelongsToMany:
|
|
150
150
|
Rails/IgnoredSkipActionFilterOption:
|
151
151
|
Enabled: false
|
152
152
|
|
153
|
+
# We do not care about this check due to its lack of configuration.
|
154
|
+
#
|
155
|
+
# Some of the team finds the naming of this method is more confusing than using
|
156
|
+
# `each_with_object`. We all agree the other examples are bad and should not be
|
157
|
+
# used:
|
158
|
+
#
|
159
|
+
# # OK for us
|
160
|
+
# [1, 2, 3].each_with_object({}) { |el, h| h[foo(el)] = el }
|
161
|
+
#
|
162
|
+
# # Bad
|
163
|
+
# [1, 2, 3].to_h { |el| [foo(el), el] }
|
164
|
+
# [1, 2, 3].map { |el| [foo(el), el] }.to_h
|
165
|
+
# Hash[[1, 2, 3].collect { |el| [foo(el), el] }]
|
166
|
+
#
|
167
|
+
# If this check supports configuration in the future so that we can allow
|
168
|
+
# `each_with_object` then we'll turn it back on.
|
169
|
+
Rails/IndexBy:
|
170
|
+
Enabled: false
|
171
|
+
|
172
|
+
# We find the name of this method to be very confusing. We'd prefer this method
|
173
|
+
# is never used.
|
174
|
+
Rails/IndexWith:
|
175
|
+
Enabled: false
|
176
|
+
|
153
177
|
# The ActiveSupport monkey patches for `present?` are nearly all defined as:
|
154
178
|
#
|
155
179
|
# !blank?
|
@@ -482,10 +482,8 @@ module Radius
|
|
482
482
|
end
|
483
483
|
|
484
484
|
# Try to load the factories defined for the specs
|
485
|
-
# rubocop:disable Lint/HandleExceptions
|
486
485
|
begin
|
487
486
|
require 'support/model_factories'
|
488
487
|
rescue LoadError
|
489
488
|
# Ignore as this is an optional convenience feature
|
490
489
|
end
|
491
|
-
# rubocop:enable Lint/HandleExceptions
|
data/lib/radius/spec/vcr.rb
CHANGED
@@ -91,10 +91,8 @@ RSpec.configure do |config|
|
|
91
91
|
end
|
92
92
|
|
93
93
|
# Try to any custom VCR config for the app
|
94
|
-
# rubocop:disable Lint/HandleExceptions
|
95
94
|
begin
|
96
95
|
require 'support/vcr'
|
97
96
|
rescue LoadError
|
98
97
|
# Ignore as this is an optional convenience feature
|
99
98
|
end
|
100
|
-
# rubocop:enable Lint/HandleExceptions
|
data/lib/radius/spec/version.rb
CHANGED
data/radius-spec.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
|
13
13
|
spec.metadata = {
|
14
14
|
"bug_tracker_uri" => "https://github.com/RadiusNetworks/radius-spec/issues",
|
15
|
-
"changelog_uri"
|
15
|
+
"changelog_uri" => "https://github.com/RadiusNetworks/radius-spec/blob/v#{Radius::Spec::VERSION}/CHANGELOG.md",
|
16
16
|
"source_code_uri" => "https://github.com/RadiusNetworks/radius-spec/tree/v#{Radius::Spec::VERSION}",
|
17
17
|
}
|
18
18
|
spec.summary = "Radius Networks RSpec setup and plug-ins"
|
@@ -21,18 +21,18 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.homepage = "https://github.com/RadiusNetworks/radius-spec"
|
22
22
|
spec.license = "Apache-2.0"
|
23
23
|
|
24
|
-
spec.files = `git ls-files -z`.split("\x0").reject
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f|
|
25
25
|
f.match(%r{^(test|spec|features)/})
|
26
|
-
|
26
|
+
}
|
27
27
|
spec.bindir = "exe"
|
28
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
|
-
spec.required_ruby_version = ">= 2.5"
|
31
|
+
spec.required_ruby_version = ">= 2.5" # rubocop:disable Gemspec/RequiredRubyVersion
|
32
32
|
|
33
33
|
spec.add_runtime_dependency "rspec", "~> 3.7"
|
34
|
-
spec.add_runtime_dependency "rubocop", "~> 0.
|
35
|
-
spec.add_runtime_dependency "rubocop-rails", "~> 2.2
|
34
|
+
spec.add_runtime_dependency "rubocop", "~> 0.82.0"
|
35
|
+
spec.add_runtime_dependency "rubocop-rails", "~> 2.5.2"
|
36
36
|
|
37
37
|
spec.add_development_dependency "bundler", ">= 2.2.10"
|
38
38
|
spec.add_development_dependency "rake", ">= 12.0", "< 14.0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radius-spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Radius Networks
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-08-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -31,28 +31,28 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.
|
34
|
+
version: 0.82.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 0.
|
41
|
+
version: 0.82.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rubocop-rails
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 2.2
|
48
|
+
version: 2.5.2
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 2.2
|
55
|
+
version: 2.5.2
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: bundler
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,10 +94,11 @@ executables: []
|
|
94
94
|
extensions: []
|
95
95
|
extra_rdoc_files: []
|
96
96
|
files:
|
97
|
+
- ".github/workflows/ci.yml"
|
98
|
+
- ".github/workflows/reviewdog.yml"
|
97
99
|
- ".gitignore"
|
98
100
|
- ".rspec"
|
99
101
|
- ".rubocop.yml"
|
100
|
-
- ".travis.yml"
|
101
102
|
- ".yardopts"
|
102
103
|
- CHANGELOG.md
|
103
104
|
- CODE_OF_CONDUCT.md
|
@@ -116,14 +117,15 @@ files:
|
|
116
117
|
- benchmarks/format_string.rb
|
117
118
|
- benchmarks/format_string_token.rb
|
118
119
|
- benchmarks/gsub_vs_tr.rb
|
120
|
+
- benchmarks/hash_each.rb
|
119
121
|
- benchmarks/hash_merge.rb
|
122
|
+
- benchmarks/hash_transform.rb
|
120
123
|
- benchmarks/kwargs.rb
|
121
124
|
- benchmarks/max_ternary.rb
|
122
125
|
- benchmarks/max_ternary_micro.rb
|
123
126
|
- benchmarks/unfreeze_string.rb
|
124
127
|
- benchmarks/unpack_first.rb
|
125
128
|
- bin/ci
|
126
|
-
- bin/ci-code-review
|
127
129
|
- bin/console
|
128
130
|
- bin/pry
|
129
131
|
- bin/rake
|
@@ -147,8 +149,8 @@ licenses:
|
|
147
149
|
- Apache-2.0
|
148
150
|
metadata:
|
149
151
|
bug_tracker_uri: https://github.com/RadiusNetworks/radius-spec/issues
|
150
|
-
changelog_uri: https://github.com/RadiusNetworks/radius-spec/blob/v0.
|
151
|
-
source_code_uri: https://github.com/RadiusNetworks/radius-spec/tree/v0.
|
152
|
+
changelog_uri: https://github.com/RadiusNetworks/radius-spec/blob/v0.8.0/CHANGELOG.md
|
153
|
+
source_code_uri: https://github.com/RadiusNetworks/radius-spec/tree/v0.8.0
|
152
154
|
post_install_message:
|
153
155
|
rdoc_options: []
|
154
156
|
require_paths:
|
data/.travis.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
bundler_args: --jobs=3 --retry=3 --without documentation debug
|
4
|
-
before_script:
|
5
|
-
- "bin/ci-code-review"
|
6
|
-
script: bin/ci
|
7
|
-
rvm:
|
8
|
-
- 2.7
|
9
|
-
- 2.6
|
10
|
-
- 2.5
|
11
|
-
- ruby-head
|
12
|
-
jobs:
|
13
|
-
allow_failures:
|
14
|
-
- rvm: ruby-head
|
15
|
-
fast_finish: true
|
data/bin/ci-code-review
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
# See:
|
4
|
-
# - https://docs.travis-ci.com/user/environment-variables/#Convenience-Variables
|
5
|
-
# - https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
|
6
|
-
# - https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
|
7
|
-
if [[ "$TRAVIS_PULL_REQUEST" = "false" ]] || [[ "$TRAVIS_BRANCH" = "production" ]]; then
|
8
|
-
exit
|
9
|
-
fi
|
10
|
-
|
11
|
-
set -e
|
12
|
-
cd "$(dirname "$0")/.."
|
13
|
-
|
14
|
-
REVIEWDOG_VERSION="0.9.9"
|
15
|
-
|
16
|
-
if ! [ "$(./bin/reviewdog -version)" = "$REVIEWDOG_VERSION" ]; then
|
17
|
-
echo "Installing reviewdog version ${REVIEWDOG_VERSION}..."
|
18
|
-
curl -fsSL https://github.com/haya14busa/reviewdog/releases/download/$REVIEWDOG_VERSION/reviewdog_linux_amd64 \
|
19
|
-
-o ./bin/reviewdog
|
20
|
-
chmod +x ./bin/reviewdog
|
21
|
-
fi
|
22
|
-
|
23
|
-
echo Rubocop Version: $(./bin/rubocop --version)
|
24
|
-
echo Review Dog Version: $(./bin/reviewdog -version)
|
25
|
-
|
26
|
-
# Add `-diff="git diff master"` to reviewdog args when running locally
|
27
|
-
./bin/rubocop --config .rubocop.yml --extra-details --display-style-guide --rails | \
|
28
|
-
./bin/reviewdog -f=rubocop -reporter=github-pr-check
|