rf-stylez 0.9.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- 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 +5 -0
- metadata +30 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 379e37d37df24166deb38eef0b97d0373a6734aeb738b8bfb80637bf118bc012
|
4
|
+
data.tar.gz: b6b1d14e28ae49b27e9e25f766d729b8bddea43b5227010b129690bbb58e19db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cba253d02a644530d184380ba14d9bc716190866c8e891f547bd791d08d016b8ecbe82ff6bf366a89af79fac879c71b6d58643b8eb4fe1968c793c6bc29bd93
|
7
|
+
data.tar.gz: 2dbb03b8a502241e7ff0494414753281bf5a5d8352c9e781a3803fcecefdb3a3addf94e399939f0946681cfa904a41f6fca1c104920a827304ba171cfa82801c
|
@@ -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', '
|
24
|
-
spec.add_runtime_dependency 'rubocop-rspec', '
|
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:
|
metadata
CHANGED
@@ -1,75 +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.12.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-08-23 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
|
-
- -
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.81'
|
20
|
-
- - "<"
|
17
|
+
- - '='
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
19
|
+
version: 1.15.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '='
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '1.2'
|
26
|
+
version: 1.15.0
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: rubocop-rails
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
|
-
- -
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '2.5'
|
40
|
-
- - "<"
|
31
|
+
- - '='
|
41
32
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
33
|
+
version: 2.10.1
|
43
34
|
type: :runtime
|
44
35
|
prerelease: false
|
45
36
|
version_requirements: !ruby/object:Gem::Requirement
|
46
37
|
requirements:
|
47
|
-
- -
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '2.5'
|
50
|
-
- - "<"
|
38
|
+
- - '='
|
51
39
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
40
|
+
version: 2.10.1
|
53
41
|
- !ruby/object:Gem::Dependency
|
54
42
|
name: rubocop-rspec
|
55
43
|
requirement: !ruby/object:Gem::Requirement
|
56
44
|
requirements:
|
57
|
-
- -
|
45
|
+
- - '='
|
58
46
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
60
|
-
- - "<"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '1.45'
|
47
|
+
version: 2.3.0
|
63
48
|
type: :runtime
|
64
49
|
prerelease: false
|
65
50
|
version_requirements: !ruby/object:Gem::Requirement
|
66
51
|
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '1.39'
|
70
|
-
- - "<"
|
52
|
+
- - '='
|
71
53
|
- !ruby/object:Gem::Version
|
72
|
-
version:
|
54
|
+
version: 2.3.0
|
73
55
|
- !ruby/object:Gem::Dependency
|
74
56
|
name: get_env
|
75
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,6 +80,20 @@ dependencies:
|
|
98
80
|
- - "~>"
|
99
81
|
- !ruby/object:Gem::Version
|
100
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'
|
101
97
|
- !ruby/object:Gem::Dependency
|
102
98
|
name: bundler
|
103
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -177,6 +173,7 @@ extensions: []
|
|
177
173
|
extra_rdoc_files: []
|
178
174
|
files:
|
179
175
|
- ".circleci/config.yml"
|
176
|
+
- ".github/dependabot.yml"
|
180
177
|
- ".gitignore"
|
181
178
|
- ".rspec"
|
182
179
|
- ".rubocop.yml"
|
@@ -195,6 +192,7 @@ files:
|
|
195
192
|
- lib/rubocop/cop/lint/no_http_party.rb
|
196
193
|
- lib/rubocop/cop/lint/no_json.rb
|
197
194
|
- lib/rubocop/cop/lint/no_untyped_raise.rb
|
195
|
+
- lib/rubocop/cop/lint/no_vcr_recording.rb
|
198
196
|
- lib/rubocop/cop/lint/obscure.rb
|
199
197
|
- lib/rubocop/cop/lint/use_positive_int32_validator.rb
|
200
198
|
- rails/rubocop.yml
|