radius-spec 0.1.1 → 0.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 +4 -4
- data/.rubocop.yml +6 -0
- data/.travis.yml +3 -0
- data/CHANGELOG.md +22 -0
- data/common_rubocop.yml +158 -0
- data/common_rubocop_rails.yml +13 -0
- data/lib/radius/spec/version.rb +1 -1
- data/radius-spec.gemspec +5 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 199cf6c21d0f54935244a6f92f77bfd2292648ae7817e0dc6d2556dca0cddb40
|
4
|
+
data.tar.gz: fe88a096f2fac711be28918c786242796616375dfd5f7d038210c577104866a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d881caef9047764de02e3e59a2de2722c620ecfd4c55c825d19d6ac2a90dceeb8e229a52363120991fd6c166737ddfef8f49e3b3b74621da9eed27318dfc221b
|
7
|
+
data.tar.gz: c8a090b6431ec6c6d3439b4947ac4640ddeb10f9b48c6c29c992e7207c0a71f1e5db48c26d630fdc95830be79b62c99ed1b2d4599eccd28c61a206615cf2de12
|
data/.rubocop.yml
CHANGED
@@ -8,3 +8,9 @@ inherit_from: common_rubocop.yml
|
|
8
8
|
Metrics/BlockLength:
|
9
9
|
Exclude:
|
10
10
|
- 'lib/radius/spec/rspec.rb'
|
11
|
+
|
12
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
13
|
+
# URISchemes: http, https
|
14
|
+
Metrics/LineLength:
|
15
|
+
Exclude:
|
16
|
+
- 'radius-spec.gemspec'
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
## 0.2.0 (May 17, 2018)
|
2
|
+
|
3
|
+
[Full Changelog](https://github.com/RadiusNetworks/radius-spec/compare/v0.1.1...v0.2.0)
|
4
|
+
|
5
|
+
### Enhancements
|
6
|
+
|
7
|
+
- Adjust common Rubocop configuration (Aaron Kromer, #2):
|
8
|
+
- Ignore `Lint/AmbiguousBlockAssociation` for specs
|
9
|
+
- Ignore long lines due to Rubocop directives
|
10
|
+
- Ignore long lines due to comments
|
11
|
+
- Prefer a line length of 80, but don't complain until 100
|
12
|
+
- Disable ASCII only comments
|
13
|
+
- Set the `MinSize` for `Style/SymbolArray` and `Style/WordArray` to three
|
14
|
+
- Use squiggly `<<~` heredoc indentation
|
15
|
+
- Allow common `EOF` as a heredoc delimiter
|
16
|
+
- Indent multi-line operations
|
17
|
+
- Allow unspecified rescue as a catch-all
|
18
|
+
- Adjust common Rubocop Rails configuration (Aaron Kromer, #2):
|
19
|
+
- Ignore `Rails/ApplicationRecord` for benchmarks
|
20
|
+
- Ignore more common gem binstubs
|
21
|
+
|
22
|
+
|
1
23
|
## 0.1.1 (March 16, 2018)
|
2
24
|
|
3
25
|
[Full Changelog](https://github.com/RadiusNetworks/radius-spec/compare/v0.1.0...v0.1.1)
|
data/common_rubocop.yml
CHANGED
@@ -51,6 +51,47 @@ Layout/ClosingParenthesisIndentation:
|
|
51
51
|
Layout/FirstParameterIndentation:
|
52
52
|
Enabled: false
|
53
53
|
|
54
|
+
# This project only uses newer Ruby versions which all support the "squiggly"
|
55
|
+
# style. We prefer to use pure Ruby calls when possible instead of relying on
|
56
|
+
# alternatives; even for Rails app.
|
57
|
+
#
|
58
|
+
# Configuration parameters: EnforcedStyle.
|
59
|
+
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
|
60
|
+
Layout/IndentHeredoc:
|
61
|
+
EnforcedStyle: squiggly
|
62
|
+
|
63
|
+
# We tend to indent multi-line operation statements. I think this is because
|
64
|
+
# it's tends to be the default style auto-formatted by VIM (which many of us
|
65
|
+
# use). It also helps show the continuation of the statement instead of it
|
66
|
+
# potentially blending in with the start of the next statement.
|
67
|
+
#
|
68
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
69
|
+
# SupportedStyles: aligned, indented
|
70
|
+
Layout/MultilineOperationIndentation:
|
71
|
+
EnforcedStyle: indented
|
72
|
+
|
73
|
+
# In our specs Rubocop inconsistently complains when using the block form of
|
74
|
+
# `expect` and `change`. It accepts code when a method is chained onto
|
75
|
+
# `change`, but otherwise it complains. Since this is a widely used pattern in
|
76
|
+
# our specs we just tell Rubocop to ignore our spec files.
|
77
|
+
#
|
78
|
+
# # Acceptable to Rubocop
|
79
|
+
# expect {
|
80
|
+
# some_action
|
81
|
+
# }.to change {
|
82
|
+
# object.state
|
83
|
+
# }.from(:original).to(:updated)
|
84
|
+
#
|
85
|
+
# # Rubocop complains
|
86
|
+
# expect {
|
87
|
+
# some_action
|
88
|
+
# }.to change {
|
89
|
+
# object.state
|
90
|
+
# }
|
91
|
+
Lint/AmbiguousBlockAssociation:
|
92
|
+
Exclude:
|
93
|
+
- 'spec/**/*_spec.rb'
|
94
|
+
|
54
95
|
# Often with benchmarking we don't explictly "use" a variable or return value.
|
55
96
|
# We simply need to perform the operation which generates said value for the
|
56
97
|
# benchmark.
|
@@ -69,6 +110,39 @@ Metrics/BlockLength:
|
|
69
110
|
- 'spec/**/*_spec.rb'
|
70
111
|
- 'spec/support/model_factories.rb'
|
71
112
|
|
113
|
+
# We generally prefer to use the default line length of 80. Though sometimes
|
114
|
+
# we just need a little extra space because it makes it easier to read.
|
115
|
+
#
|
116
|
+
# The only way to disable Rubocop for a single line is either to wrap the line
|
117
|
+
# with two comments or append the disable comment to the end of the line. For
|
118
|
+
# guard clauses, we tend to prefer trailing comments to avoid adding two lines
|
119
|
+
# just to disable a cop on one line.
|
120
|
+
#
|
121
|
+
# Sometimes comments include ASCII diagrams, flow charts, etc. These cannot
|
122
|
+
# always be reformatted to fit within the 80 column limit. Also, we write most
|
123
|
+
# comments in markdown format. Rubocop isn't very good at understanding when
|
124
|
+
# the line is long because of a URL in a markdown link. Instead of requiring
|
125
|
+
# additional comments to turn this cop off for comments we ignore any long
|
126
|
+
# lines which are only comments.
|
127
|
+
#
|
128
|
+
# There are also cases where for one valid reason or another we have a trailing
|
129
|
+
# comment that extends a little too far. We'd like to be able to ignore those
|
130
|
+
# as well. This _attempts_ to do that, however, as this uses simple regular
|
131
|
+
# expressions we can only attempt to match so much. We probably should change
|
132
|
+
# this for a node pattern matcher in the future.
|
133
|
+
#
|
134
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes,
|
135
|
+
# IgnoreCopDirectives, IgnoredPatterns.
|
136
|
+
# URISchemes: http, https
|
137
|
+
Metrics/LineLength:
|
138
|
+
IgnoreCopDirectives: true
|
139
|
+
IgnoredPatterns:
|
140
|
+
# Leading comments
|
141
|
+
- '\A\s*#'
|
142
|
+
# Attempt at trailing comments
|
143
|
+
- '\A.{1,78}\s#\s.*\z'
|
144
|
+
Max: 100
|
145
|
+
|
72
146
|
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
73
147
|
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
74
148
|
Naming/FileName:
|
@@ -77,6 +151,18 @@ Naming/FileName:
|
|
77
151
|
- '**/*.gemspec'
|
78
152
|
- '**/Brewfile'
|
79
153
|
|
154
|
+
# This allows `EOF` as the only `EO*` variant.
|
155
|
+
#
|
156
|
+
# `EOF` is a common terminal abbreviate indicating end-of-file. We allow this
|
157
|
+
# for those heredocs which represent "file" text.
|
158
|
+
#
|
159
|
+
# Configuration parameters: Blacklist.
|
160
|
+
# Blacklist: END, (?-mix:EO[A-Z]{1})
|
161
|
+
Naming/HeredocDelimiterNaming:
|
162
|
+
Blacklist:
|
163
|
+
- 'END'
|
164
|
+
- '(?-mix:EO[A-EG-Z]{1})'
|
165
|
+
|
80
166
|
# `alias` behavior changes on scope. In general we expect the behavior to be
|
81
167
|
# that which is defined by `alias_method`.
|
82
168
|
#
|
@@ -87,6 +173,13 @@ Naming/FileName:
|
|
87
173
|
Style/Alias:
|
88
174
|
EnforcedStyle: prefer_alias_method
|
89
175
|
|
176
|
+
# These days most people have editors which support unicode and other
|
177
|
+
# non-ASCII characters.
|
178
|
+
#
|
179
|
+
# Configuration parameters: AllowedChars.
|
180
|
+
Style/AsciiComments:
|
181
|
+
Enabled: false
|
182
|
+
|
90
183
|
# Use semantic style for blocks:
|
91
184
|
# - Prefer `do...end` over `{...}` for procedural blocks.
|
92
185
|
# - Prefer `{...}` over `do...end` for functional blocks.
|
@@ -215,6 +308,47 @@ Style/NumericPredicate:
|
|
215
308
|
Style/RegexpLiteral:
|
216
309
|
EnforcedStyle: mixed
|
217
310
|
|
311
|
+
# If you only need to rescue a single, or predefined set of exceptions, then
|
312
|
+
# catch the exceptions explicitly. However, when you need to include a general
|
313
|
+
# error handler / "catch-all" use the "unspecified rescue".
|
314
|
+
#
|
315
|
+
# Using the unspecified `rescue` on blocks is common Ruby practice. It is a
|
316
|
+
# core feature of the language which has semantic meaning. The Rubocop docs do
|
317
|
+
# not provide much justification for defaulting to an explicit style and there
|
318
|
+
# is no real mention of this in the associated style guide except the following
|
319
|
+
# buried in an example for [_Avoid rescuing the `Exception`
|
320
|
+
# class_](https://github.com/bbatsov/ruby-style-guide#no-blind-rescues) though
|
321
|
+
# the anchor suggests this is for "no blind rescues":
|
322
|
+
#
|
323
|
+
# > # a blind rescue rescues from StandardError, not Exception as many
|
324
|
+
# > # programmers assume.
|
325
|
+
#
|
326
|
+
# Our general rule for Ruby exceptions is to create your custom errors from
|
327
|
+
# `StandardError`. Creating custom errors off of `Exception` is reserved for
|
328
|
+
# special edge cases where you don't intend for someone to normally catch it
|
329
|
+
# (such as system resource issues; e.g. `NoMemoryError`, `SecurityError`).
|
330
|
+
#
|
331
|
+
# With that in mind, we can make the same counter argument that since
|
332
|
+
# programmers generally assume the unspecified rescue rescues `Exception`,
|
333
|
+
# which they normally should not be rescuing, system errors are more likely to
|
334
|
+
# noticed.
|
335
|
+
#
|
336
|
+
# Additionally, use of the unspecified rescue looks and behaves like a
|
337
|
+
# "catch-all" or the `else` clause in a `case` statement:
|
338
|
+
#
|
339
|
+
# begin
|
340
|
+
# # do something that may cause a standard error
|
341
|
+
# rescue TypeError
|
342
|
+
# handle_type_error
|
343
|
+
# rescue => e
|
344
|
+
# handle_error e
|
345
|
+
# end
|
346
|
+
#
|
347
|
+
# Configuration parameters: EnforcedStyle.
|
348
|
+
# SupportedStyles: implicit, explicit
|
349
|
+
Style/RescueStandardError:
|
350
|
+
EnforcedStyle: implicit
|
351
|
+
|
218
352
|
# We generally prefer double quotes but many generators use single quotes. We
|
219
353
|
# don't view the performance difference to be all that much so we don't care
|
220
354
|
# if the style is mixed or double quotes are used for static strings.
|
@@ -224,6 +358,18 @@ Style/RegexpLiteral:
|
|
224
358
|
Style/StringLiterals:
|
225
359
|
Enabled: false
|
226
360
|
|
361
|
+
# We don't feel too strongly about percent vs bracket array style. We tend to
|
362
|
+
# use the percent style, which also happens to be Rubocop's default. So for
|
363
|
+
# pedantic consistency we'll enforce this.
|
364
|
+
#
|
365
|
+
# However, as we don't feel that strongly about this we'll increase the
|
366
|
+
# minimum size to 3 to allow very small arrays to exist either way.
|
367
|
+
#
|
368
|
+
# Configuration parameters: EnforcedStyle, MinSize.
|
369
|
+
# SupportedStyles: percent, brackets
|
370
|
+
Style/SymbolArray:
|
371
|
+
MinSize: 3
|
372
|
+
|
227
373
|
# When ternaries become complex they can be difficult to read due to increased
|
228
374
|
# cognative load parsing the expression. Cognative load can increase further
|
229
375
|
# when assignment is involved.
|
@@ -282,6 +428,18 @@ Style/TrailingCommaInHashLiteral:
|
|
282
428
|
simplifies adding, removing, and re-arranging the elements.
|
283
429
|
EnforcedStyleForMultiline: consistent_comma
|
284
430
|
|
431
|
+
# We don't feel too strongly about percent vs bracket array style. We tend to
|
432
|
+
# use the percent style, which also happens to be Rubocop's default. So for
|
433
|
+
# pedantic consistency we'll enforce this.
|
434
|
+
#
|
435
|
+
# However, as we don't feel that strongly about this we'll increase the
|
436
|
+
# minimum size to 3 to allow very small arrays to exist either way.
|
437
|
+
#
|
438
|
+
# Configuration parameters: EnforcedStyle, MinSize, WordRegex.
|
439
|
+
# SupportedStyles: percent, brackets
|
440
|
+
Style/WordArray:
|
441
|
+
MinSize: 3
|
442
|
+
|
285
443
|
# When it comes to constants it's safer to place the constant on the right-hand
|
286
444
|
# side. With a constant accidental assignment will produce a syntax error.
|
287
445
|
#
|
data/common_rubocop_rails.yml
CHANGED
@@ -11,9 +11,11 @@ Rails:
|
|
11
11
|
AllCops:
|
12
12
|
Exclude:
|
13
13
|
- 'bin/puma'
|
14
|
+
- 'bin/pumactl'
|
14
15
|
- 'bin/rails'
|
15
16
|
- 'bin/shoryuken'
|
16
17
|
- 'bin/sidekiq'
|
18
|
+
- 'bin/sidekiqctl'
|
17
19
|
- 'bin/spring'
|
18
20
|
- 'db/schema.rb'
|
19
21
|
- 'db/migrate/**/*'
|
@@ -36,6 +38,17 @@ Metrics/LineLength:
|
|
36
38
|
- '\A# fk_rails_'
|
37
39
|
- '\A# index_'
|
38
40
|
|
41
|
+
# Ignore subclass parent for one off benchmarks
|
42
|
+
#
|
43
|
+
# Benchmarks are generally meant to be small and targeted. They often have
|
44
|
+
# custom model declarations which help direct the focus of the benchmarks.
|
45
|
+
# These one-off models exist outside of the main Rails app. We don't want this
|
46
|
+
# cop to run for them because including `ApplicationRecord` is unnecessary in
|
47
|
+
# these cases and just adds noise to the setup.
|
48
|
+
Rails/ApplicationRecord:
|
49
|
+
Exclude:
|
50
|
+
- 'benchmarks/**/*'
|
51
|
+
|
39
52
|
# As Rails defaults to creating timestamps you need to go out of your way to
|
40
53
|
# explicitly have them removed from the table. This cop is almost always a
|
41
54
|
# false negative so we're disabling it.
|
data/lib/radius/spec/version.rb
CHANGED
data/radius-spec.gemspec
CHANGED
@@ -10,6 +10,11 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = ["Radius Networks", "Aaron Kromer"]
|
11
11
|
spec.email = ["support@radiusnetworks.com"]
|
12
12
|
|
13
|
+
spec.metadata = {
|
14
|
+
"bug_tracker_uri" => "https://github.com/RadiusNetworks/radius-spec/issues",
|
15
|
+
"changelog_uri" => "https://github.com/RadiusNetworks/radius-spec/blob/v#{Radius::Spec::VERSION}/CHANGELOG.md",
|
16
|
+
"source_code_uri" => "https://github.com/RadiusNetworks/radius-spec/tree/v#{Radius::Spec::VERSION}",
|
17
|
+
}
|
13
18
|
spec.summary = "Radius Networks RSpec setup and plug-ins"
|
14
19
|
spec.description = "Standard RSpec setup and a collection of plug-ins " \
|
15
20
|
"to help improve specs."
|
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.2.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: 2018-
|
12
|
+
date: 2018-05-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -91,7 +91,10 @@ files:
|
|
91
91
|
homepage: https://github.com/RadiusNetworks/radius-spec
|
92
92
|
licenses:
|
93
93
|
- Apache-2.0
|
94
|
-
metadata:
|
94
|
+
metadata:
|
95
|
+
bug_tracker_uri: https://github.com/RadiusNetworks/radius-spec/issues
|
96
|
+
changelog_uri: https://github.com/RadiusNetworks/radius-spec/blob/v0.2.0/CHANGELOG.md
|
97
|
+
source_code_uri: https://github.com/RadiusNetworks/radius-spec/tree/v0.2.0
|
95
98
|
post_install_message:
|
96
99
|
rdoc_options: []
|
97
100
|
require_paths:
|