rf-stylez 0.10.0 → 0.13.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/dependabot.yml +17 -0
- data/lib/rf/stylez/version.rb +1 -1
- data/lib/rf/stylez.rb +1 -0
- data/lib/rubocop/cop/lint/no_vcr_recording.rb +74 -0
- data/rf-stylez.gemspec +4 -3
- data/ruby/rubocop.yml +17 -1
- metadata +26 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54b5d943630d52ab7cf7511104196476c15f9f02e6f52defb435fd20e6ab743b
|
4
|
+
data.tar.gz: 8732cd5d8f52c6401be14b08bd935b9822731826306591b23e01e983d5750669
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1235de1199e69b9dc116b9119ff2b8c95db7c7c4c93e02a03cca7f0356a56b6d8d33e4bdf2f29082f2b499d9e5fc9993c69b54536e0a8cd3731b469b52289b61
|
7
|
+
data.tar.gz: 5253a7bbbeb5457740e585992498dc443dd6133e68f189a2d9442464eeda006736d90f4f35fcab05d28194464d3336699949820b819cf33b1ac2e48b817f3637
|
@@ -0,0 +1,17 @@
|
|
1
|
+
version: 2
|
2
|
+
updates:
|
3
|
+
- package-ecosystem: bundler
|
4
|
+
directory: "/"
|
5
|
+
schedule:
|
6
|
+
interval: daily
|
7
|
+
time: "13:00"
|
8
|
+
open-pull-requests-limit: 10
|
9
|
+
ignore:
|
10
|
+
- dependency-name: rubocop
|
11
|
+
versions:
|
12
|
+
- 1.10.0
|
13
|
+
- 1.12.0
|
14
|
+
- 1.9.0
|
15
|
+
- dependency-name: rubocop-rspec
|
16
|
+
versions:
|
17
|
+
- 2.1.0
|
data/lib/rf/stylez/version.rb
CHANGED
data/lib/rf/stylez.rb
CHANGED
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'unparser'
|
3
|
+
|
4
|
+
module RuboCop
|
5
|
+
module Cop
|
6
|
+
module Lint
|
7
|
+
# @example
|
8
|
+
# # bad
|
9
|
+
# vcr: { record_mode: :once, tag: :foo }
|
10
|
+
# vcr: { record_mode: :none }
|
11
|
+
#
|
12
|
+
# # good
|
13
|
+
# vcr: { tag: :foo }
|
14
|
+
# vcr: true
|
15
|
+
class NoVCRRecording < RuboCop::Cop::Base
|
16
|
+
extend AutoCorrector
|
17
|
+
|
18
|
+
MSG = 'Do not set :record option in VCR'.freeze
|
19
|
+
|
20
|
+
def_node_search :is_only_setting_record_option?, <<~PATTERN
|
21
|
+
(pair
|
22
|
+
(sym :vcr)
|
23
|
+
(hash
|
24
|
+
(pair
|
25
|
+
(sym :record)
|
26
|
+
...
|
27
|
+
)
|
28
|
+
)
|
29
|
+
)
|
30
|
+
PATTERN
|
31
|
+
def_node_search :is_setting_record_option?, <<~PATTERN
|
32
|
+
(pair
|
33
|
+
(sym :vcr)
|
34
|
+
(hash
|
35
|
+
<
|
36
|
+
(pair
|
37
|
+
(sym :record)
|
38
|
+
...
|
39
|
+
)
|
40
|
+
...
|
41
|
+
>
|
42
|
+
)
|
43
|
+
)
|
44
|
+
PATTERN
|
45
|
+
|
46
|
+
def on_pair(node)
|
47
|
+
return unless is_only_setting_record_option?(node) || is_setting_record_option?(node)
|
48
|
+
|
49
|
+
add_offense(node) do |corrector|
|
50
|
+
if is_only_setting_record_option?(node)
|
51
|
+
corrector.replace(node, 'vcr: true')
|
52
|
+
elsif is_setting_record_option?(node)
|
53
|
+
corrector.replace(node, remove_record_option(node))
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def remove_record_option(top_pair_node)
|
61
|
+
extend AST::Sexp
|
62
|
+
|
63
|
+
_vcr_key, hash = top_pair_node.children
|
64
|
+
other_options = hash.children.reject do |pair|
|
65
|
+
key, _value = pair.children
|
66
|
+
key == s(:sym, :record)
|
67
|
+
end
|
68
|
+
|
69
|
+
Unparser.unparse(s(:pair, s(:sym, :vcr), s(:hash, *other_options)))
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
data/rf-stylez.gemspec
CHANGED
@@ -19,11 +19,12 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = ['rf-stylez']
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_runtime_dependency 'rubocop', '
|
23
|
-
spec.add_runtime_dependency 'rubocop-rails', '2.
|
24
|
-
spec.add_runtime_dependency 'rubocop-rspec', '2.
|
22
|
+
spec.add_runtime_dependency 'rubocop', '1.15.0'
|
23
|
+
spec.add_runtime_dependency 'rubocop-rails', '2.10.1'
|
24
|
+
spec.add_runtime_dependency 'rubocop-rspec', '2.3.0'
|
25
25
|
spec.add_runtime_dependency 'get_env', '~> 0.2.0'
|
26
26
|
spec.add_runtime_dependency 'semantic_versioning', '~> 0.2'
|
27
|
+
spec.add_runtime_dependency 'unparser', '~> 0.6'
|
27
28
|
|
28
29
|
spec.add_development_dependency 'bundler', '~> 2.1'
|
29
30
|
spec.add_development_dependency 'rake', '~> 13.0'
|
data/ruby/rubocop.yml
CHANGED
@@ -34,6 +34,10 @@ Lint/UsePositiveInt32Validator:
|
|
34
34
|
Enabled: true
|
35
35
|
Lint/NoJSON:
|
36
36
|
Enabled: true
|
37
|
+
Lint/NoVCRRecording:
|
38
|
+
Enabled: true
|
39
|
+
Include:
|
40
|
+
- spec/**/*
|
37
41
|
|
38
42
|
# Good style cops
|
39
43
|
Layout/BlockAlignment:
|
@@ -50,6 +54,7 @@ Layout/TrailingWhitespace:
|
|
50
54
|
Enabled: true
|
51
55
|
Layout/EmptyLineBetweenDefs:
|
52
56
|
Enabled: true
|
57
|
+
EmptyLineBetweenClassDefs: false
|
53
58
|
Layout/IndentationWidth:
|
54
59
|
Enabled: true
|
55
60
|
Layout/AccessModifierIndentation:
|
@@ -130,7 +135,18 @@ Style/MethodCallWithoutArgsParentheses:
|
|
130
135
|
Style/InfiniteLoop:
|
131
136
|
Enabled: true
|
132
137
|
Style/StringLiterals:
|
133
|
-
|
138
|
+
Description: 'Checks if uses of quotes match the configured preference.'
|
139
|
+
StyleGuide: '#consistent-string-literals'
|
140
|
+
Enabled: true
|
141
|
+
VersionAdded: '0.9'
|
142
|
+
VersionChanged: '0.36'
|
143
|
+
EnforcedStyle: double_quotes
|
144
|
+
SupportedStyles:
|
145
|
+
- single_quotes
|
146
|
+
- double_quotes
|
147
|
+
# If `true`, strings which span multiple lines using `\` for continuation must
|
148
|
+
# use the same type of quotes on each line.
|
149
|
+
ConsistentQuotesInMultiline: true
|
134
150
|
Style/AndOr:
|
135
151
|
Enabled: true
|
136
152
|
Style/Not:
|
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rf-stylez
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emanuel Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.15.0
|
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.
|
26
|
+
version: 1.15.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubocop-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.10.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: 2.10.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop-rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
47
|
+
version: 2.3.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.
|
54
|
+
version: 2.3.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: get_env
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: unparser
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.6'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.6'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: bundler
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,6 +173,7 @@ extensions: []
|
|
159
173
|
extra_rdoc_files: []
|
160
174
|
files:
|
161
175
|
- ".circleci/config.yml"
|
176
|
+
- ".github/dependabot.yml"
|
162
177
|
- ".gitignore"
|
163
178
|
- ".rspec"
|
164
179
|
- ".rubocop.yml"
|
@@ -177,6 +192,7 @@ files:
|
|
177
192
|
- lib/rubocop/cop/lint/no_http_party.rb
|
178
193
|
- lib/rubocop/cop/lint/no_json.rb
|
179
194
|
- lib/rubocop/cop/lint/no_untyped_raise.rb
|
195
|
+
- lib/rubocop/cop/lint/no_vcr_recording.rb
|
180
196
|
- lib/rubocop/cop/lint/obscure.rb
|
181
197
|
- lib/rubocop/cop/lint/use_positive_int32_validator.rb
|
182
198
|
- rails/rubocop.yml
|