carwow_rubocop 4.2.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +37 -35
- data/carwow_rubocop.gemspec +1 -1
- data/config/default.yml +1 -0
- data/config/rubocop-carwow.yml +5 -0
- data/config/rubocop-factory_bot.yml +8 -0
- data/config/rubocop-rspec.yml +0 -4
- data/lib/rubocop/carwow/version.rb +1 -1
- data/lib/rubocop/cop/carwow/add_column_with_comment.rb +65 -0
- metadata +23 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2502f69ed5e5cd4255c0b1bf1c5c693aaf99d59a8b098ab35eef2dcd3d7b7eff
|
4
|
+
data.tar.gz: 2c5e6df20f64962209d92ee0fd8c709cfdc4ea90f09406ca84473bbe53bbb19e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91474e6f5948d8a99c2f82d6835dd680308bbcda86273639b78a54f750af43fc6dd8763a7b10c33467426f3dbece2a3170f610a1a02915d01ca4599b12fff828
|
7
|
+
data.tar.gz: bab97908a5aec300ca75d9ea208e0b99fb70da355958fa50b7f5f69882cc16de63c89c602509577dac7b0337acbc4e9c734e8fd268bc56b83681bd7f87aa6537
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
carwow_rubocop (
|
4
|
+
carwow_rubocop (6.0.0)
|
5
5
|
rubocop (>= 1.44)
|
6
|
+
rubocop-factory_bot
|
6
7
|
rubocop-performance
|
7
8
|
rubocop-rspec
|
8
9
|
|
@@ -11,54 +12,55 @@ GEM
|
|
11
12
|
specs:
|
12
13
|
ast (2.4.2)
|
13
14
|
coderay (1.1.3)
|
14
|
-
diff-lcs (1.5.
|
15
|
-
json (2.
|
15
|
+
diff-lcs (1.5.1)
|
16
|
+
json (2.7.2)
|
17
|
+
language_server-protocol (3.17.0.3)
|
16
18
|
method_source (1.0.0)
|
17
|
-
parallel (1.
|
18
|
-
parser (3.
|
19
|
+
parallel (1.26.3)
|
20
|
+
parser (3.3.5.0)
|
19
21
|
ast (~> 2.4.1)
|
22
|
+
racc
|
20
23
|
pry (0.14.2)
|
21
24
|
coderay (~> 1.1)
|
22
25
|
method_source (~> 1.0)
|
26
|
+
racc (1.8.1)
|
23
27
|
rainbow (3.1.1)
|
24
|
-
rake (13.
|
25
|
-
regexp_parser (2.
|
26
|
-
|
27
|
-
|
28
|
-
rspec-
|
29
|
-
rspec-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
rspec-expectations (3.12.2)
|
28
|
+
rake (13.2.1)
|
29
|
+
regexp_parser (2.9.2)
|
30
|
+
rspec (3.13.0)
|
31
|
+
rspec-core (~> 3.13.0)
|
32
|
+
rspec-expectations (~> 3.13.0)
|
33
|
+
rspec-mocks (~> 3.13.0)
|
34
|
+
rspec-core (3.13.0)
|
35
|
+
rspec-support (~> 3.13.0)
|
36
|
+
rspec-expectations (3.13.0)
|
34
37
|
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
-
rspec-support (~> 3.
|
36
|
-
rspec-mocks (3.
|
38
|
+
rspec-support (~> 3.13.0)
|
39
|
+
rspec-mocks (3.13.1)
|
37
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
-
rspec-support (~> 3.
|
39
|
-
rspec-support (3.
|
40
|
-
rubocop (1.
|
41
|
+
rspec-support (~> 3.13.0)
|
42
|
+
rspec-support (3.13.1)
|
43
|
+
rubocop (1.66.1)
|
41
44
|
json (~> 2.3)
|
45
|
+
language_server-protocol (>= 3.17.0)
|
42
46
|
parallel (~> 1.10)
|
43
|
-
parser (>= 3.
|
47
|
+
parser (>= 3.3.0.2)
|
44
48
|
rainbow (>= 2.2.2, < 4.0)
|
45
|
-
regexp_parser (>=
|
46
|
-
|
47
|
-
rubocop-ast (>= 1.28.0, < 2.0)
|
49
|
+
regexp_parser (>= 2.4, < 3.0)
|
50
|
+
rubocop-ast (>= 1.32.2, < 2.0)
|
48
51
|
ruby-progressbar (~> 1.7)
|
49
52
|
unicode-display_width (>= 2.4.0, < 3.0)
|
50
|
-
rubocop-ast (1.
|
51
|
-
parser (>= 3.
|
52
|
-
rubocop-
|
53
|
-
rubocop (~> 1.
|
54
|
-
rubocop-performance (1.
|
55
|
-
rubocop (>= 1.
|
56
|
-
rubocop-ast (>=
|
57
|
-
rubocop-rspec (
|
58
|
-
rubocop (~> 1.
|
59
|
-
rubocop-capybara (~> 2.17)
|
53
|
+
rubocop-ast (1.32.3)
|
54
|
+
parser (>= 3.3.1.0)
|
55
|
+
rubocop-factory_bot (2.26.1)
|
56
|
+
rubocop (~> 1.61)
|
57
|
+
rubocop-performance (1.22.1)
|
58
|
+
rubocop (>= 1.48.1, < 2.0)
|
59
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
60
|
+
rubocop-rspec (3.0.5)
|
61
|
+
rubocop (~> 1.61)
|
60
62
|
ruby-progressbar (1.13.0)
|
61
|
-
unicode-display_width (2.
|
63
|
+
unicode-display_width (2.6.0)
|
62
64
|
|
63
65
|
PLATFORMS
|
64
66
|
ruby
|
data/carwow_rubocop.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_dependency 'rubocop', '>= 1.44'
|
37
37
|
spec.add_dependency 'rubocop-performance'
|
38
38
|
spec.add_dependency 'rubocop-rspec'
|
39
|
+
spec.add_dependency 'rubocop-factory_bot'
|
39
40
|
spec.metadata = {
|
40
|
-
'rubygems_mfa_required' => 'true'
|
41
41
|
}
|
42
42
|
end
|
data/config/default.yml
CHANGED
data/config/rubocop-carwow.yml
CHANGED
data/config/rubocop-rspec.yml
CHANGED
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rubocop'
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Cop
|
7
|
+
module Carwow
|
8
|
+
# Checks the migration to confirm that new columns have a comment.
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# # bad
|
12
|
+
# add_column :users, :name, :string
|
13
|
+
#
|
14
|
+
# # bad
|
15
|
+
# create_table :users do |t|
|
16
|
+
# t.string :name
|
17
|
+
# t.string :email
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# # good
|
21
|
+
# add_column :users, :name, :string, comment: 'The name of the user'
|
22
|
+
#
|
23
|
+
# # good
|
24
|
+
# create_table :users do |t|
|
25
|
+
# t.string :name, comment: 'The name of the user'
|
26
|
+
# t.string :email, comment: 'The email of the user'
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
class AddColumnWithComment < Cop
|
30
|
+
MSG = "Missing 'comment' parameter for new column."
|
31
|
+
|
32
|
+
def_node_matcher :inside_create_table_block?, <<~PATTERN
|
33
|
+
(block (send nil? :create_table ...) (args ...) ...)
|
34
|
+
PATTERN
|
35
|
+
|
36
|
+
def_node_matcher :add_column?, <<~PATTERN
|
37
|
+
(send nil? :add_column ...)
|
38
|
+
PATTERN
|
39
|
+
|
40
|
+
def on_send(node)
|
41
|
+
return unless add_column?(node) || inside_create_table_block?(node.parent.parent)
|
42
|
+
|
43
|
+
# Timestamps and indexes do not need comments
|
44
|
+
return if %i[timestamps index].include?(node.method_name)
|
45
|
+
|
46
|
+
# Extract arguments
|
47
|
+
_receiver, _method_name, *args = *node
|
48
|
+
|
49
|
+
# Check if there is a 'comment' argument
|
50
|
+
comment_arg = find_comment_arg(args)
|
51
|
+
|
52
|
+
return if comment_arg
|
53
|
+
|
54
|
+
add_offense(node, location: :expression, message: MSG)
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def find_comment_arg(args)
|
60
|
+
args.find { |arg| arg.hash_type? && arg.pairs.any? { |pair| pair.key.value == :comment } }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carwow_rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- carwow Developers
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-factory_bot
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: All carwow's ruby projects will follow these rules
|
112
126
|
email:
|
113
127
|
- developers@carwow.co.uk
|
@@ -130,6 +144,7 @@ files:
|
|
130
144
|
- config/default.yml
|
131
145
|
- config/rubocop-bundler.yml
|
132
146
|
- config/rubocop-carwow.yml
|
147
|
+
- config/rubocop-factory_bot.yml
|
133
148
|
- config/rubocop-gemspec.yml
|
134
149
|
- config/rubocop-layout.yml
|
135
150
|
- config/rubocop-lint.yml
|
@@ -144,6 +159,7 @@ files:
|
|
144
159
|
- lib/rubocop/carwow.rb
|
145
160
|
- lib/rubocop/carwow/inject.rb
|
146
161
|
- lib/rubocop/carwow/version.rb
|
162
|
+
- lib/rubocop/cop/carwow/add_column_with_comment.rb
|
147
163
|
- lib/rubocop/cop/carwow/jobs.rb
|
148
164
|
- lib/rubocop/cop/carwow/jobs_must_define_queue.rb
|
149
165
|
- lib/rubocop/cop/carwow/jobs_queue_name_style.rb
|
@@ -151,9 +167,8 @@ files:
|
|
151
167
|
homepage: https://github.com/carwow/carwow_rubocop
|
152
168
|
licenses:
|
153
169
|
- MIT
|
154
|
-
metadata:
|
155
|
-
|
156
|
-
post_install_message:
|
170
|
+
metadata: {}
|
171
|
+
post_install_message:
|
157
172
|
rdoc_options: []
|
158
173
|
require_paths:
|
159
174
|
- lib
|
@@ -168,8 +183,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
183
|
- !ruby/object:Gem::Version
|
169
184
|
version: '0'
|
170
185
|
requirements: []
|
171
|
-
rubygems_version: 3.
|
172
|
-
signing_key:
|
186
|
+
rubygems_version: 3.5.20
|
187
|
+
signing_key:
|
173
188
|
specification_version: 4
|
174
189
|
summary: carwow's rubocop configuration
|
175
190
|
test_files: []
|