sevencop 0.19.1 → 0.20.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 +1 -1
- data/README.md +1 -0
- data/config/default.yml +14 -0
- data/data/reserved_words_mysql.txt +750 -0
- data/lib/rubocop/cop/sevencop/rails_migration_reserved_word_mysql.rb +249 -0
- data/lib/sevencop/version.rb +1 -1
- data/lib/sevencop.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c8749d14f3f47fd27af7e3f83f5a31ab99c393082cc6b6a054dfdb78cc1d584
|
4
|
+
data.tar.gz: 183cfc453319b5cceda49fa1764c604c667c9ba82325c5f2b0db3d61ecb23309
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a00296da37481256fa87d3188bf86234c9e0bffed432d211c0d563c544d99b6e3db90545bf3a253e07320538cb2d34785e5d186c491e9258bf14b0ab904b0820
|
7
|
+
data.tar.gz: 88c879ff1c21fcd60e25fcf2cb1c06947175baaa84a7877d583225e3cdb76c040af926a9a348e6b8dc920f3b86fd931d88a1f4201af162b3dbef729b4c14549a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -36,6 +36,7 @@ Choose the cops you want to use and enable them on your .rubocop.yml.
|
|
36
36
|
- [Sevencop/MethodDefinitionOrdered](lib/rubocop/cop/sevencop/method_definition_ordered.rb)
|
37
37
|
- [Sevencop/RailsBelongsToOptional](lib/rubocop/cop/sevencop/rails_belongs_to_optional.rb)
|
38
38
|
- [Sevencop/RailsInferredSpecType](lib/rubocop/cop/sevencop/rails_inferred_spec_type.rb)
|
39
|
+
- [Sevencop/RailsMigrationReservedWordMysql](lib/rubocop/cop/sevencop/rails_migration_reserved_word_mysql.rb)
|
39
40
|
- [Sevencop/RailsOrderField](lib/rubocop/cop/sevencop/rails_order_field.rb)
|
40
41
|
- [Sevencop/RailsUniquenessValidatorExplicitCaseSensitivity](lib/rubocop/cop/sevencop/rails_uniqueness_validator_explicit_case_sensitivity.rb)
|
41
42
|
- [Sevencop/RailsWhereNot](lib/rubocop/cop/sevencop/rails_where_not.rb)
|
data/config/default.yml
CHANGED
@@ -2,12 +2,14 @@ Sevencop/AutoloadOrdered:
|
|
2
2
|
Description: |
|
3
3
|
Sort `autoload` in alphabetical order.
|
4
4
|
Enabled: false
|
5
|
+
Safe: false
|
5
6
|
VersionAdded: '0.12'
|
6
7
|
|
7
8
|
Sevencop/HashElementOrdered:
|
8
9
|
Description: |
|
9
10
|
Sort Hash elements by key.
|
10
11
|
Enabled: false
|
12
|
+
Safe: false
|
11
13
|
VersionAdded: '0.6'
|
12
14
|
|
13
15
|
Sevencop/MethodDefinitionArgumentsMultiline:
|
@@ -20,18 +22,21 @@ Sevencop/MethodDefinitionInIncluded:
|
|
20
22
|
Description: |
|
21
23
|
Do not define methods in `included` blocks.
|
22
24
|
Enabled: false
|
25
|
+
Safe: false
|
23
26
|
VersionAdded: '0.19'
|
24
27
|
|
25
28
|
Sevencop/MethodDefinitionOrdered:
|
26
29
|
Description: |
|
27
30
|
Sort method definitions in alphabetical order.
|
28
31
|
Enabled: false
|
32
|
+
Safe: false
|
29
33
|
VersionAdded: '0.14'
|
30
34
|
|
31
35
|
Sevencop/MethodDefinitionKeywordArgumentOrdered:
|
32
36
|
Description: |
|
33
37
|
Sort method definition keyword arguments in alphabetical order.
|
34
38
|
Enabled: false
|
39
|
+
Safe: false
|
35
40
|
VersionAdded: '0.13'
|
36
41
|
|
37
42
|
Sevencop/RailsBelongsToOptional:
|
@@ -45,8 +50,16 @@ Sevencop/RailsInferredSpecType:
|
|
45
50
|
Description: |
|
46
51
|
Identifies redundant spec type.
|
47
52
|
Enabled: false
|
53
|
+
Safe: false
|
48
54
|
VersionAdded: '0.9'
|
49
55
|
|
56
|
+
Sevencop/RailsMigrationReservedWordMysql:
|
57
|
+
Description: |
|
58
|
+
Avoid using MySQL reserved words as identifiers.
|
59
|
+
Enabled: false
|
60
|
+
Safe: false
|
61
|
+
VersionAdded: '0.20'
|
62
|
+
|
50
63
|
Sevencop/RailsOrderField:
|
51
64
|
Description: |
|
52
65
|
Wrap safe SQL String by `Arel.sql`.
|
@@ -72,6 +85,7 @@ Sevencop/RequireOrdered:
|
|
72
85
|
Description: |
|
73
86
|
Sort `require` and `require_relative` in alphabetical order.
|
74
87
|
Enabled: false
|
88
|
+
Safe: false
|
75
89
|
VersionAdded: '0.16'
|
76
90
|
|
77
91
|
Sevencop/RSpecDescribeHttpEndpoint:
|
@@ -0,0 +1,750 @@
|
|
1
|
+
accessible
|
2
|
+
account
|
3
|
+
action
|
4
|
+
active
|
5
|
+
add
|
6
|
+
admin
|
7
|
+
after
|
8
|
+
against
|
9
|
+
aggregate
|
10
|
+
algorithm
|
11
|
+
all
|
12
|
+
alter
|
13
|
+
always
|
14
|
+
analyse
|
15
|
+
analyze
|
16
|
+
and
|
17
|
+
any
|
18
|
+
array
|
19
|
+
as
|
20
|
+
asc
|
21
|
+
ascii
|
22
|
+
asensitive
|
23
|
+
at
|
24
|
+
attribute
|
25
|
+
authentication
|
26
|
+
auto_increment
|
27
|
+
autoextend_size
|
28
|
+
avg
|
29
|
+
avg_row_length
|
30
|
+
backup
|
31
|
+
before
|
32
|
+
begin
|
33
|
+
between
|
34
|
+
bigint
|
35
|
+
binary
|
36
|
+
binlog
|
37
|
+
bit
|
38
|
+
blob
|
39
|
+
block
|
40
|
+
bool
|
41
|
+
boolean
|
42
|
+
both
|
43
|
+
btree
|
44
|
+
buckets
|
45
|
+
by
|
46
|
+
byte
|
47
|
+
cache
|
48
|
+
call
|
49
|
+
cascade
|
50
|
+
cascaded
|
51
|
+
case
|
52
|
+
catalog_name
|
53
|
+
chain
|
54
|
+
challenge_response
|
55
|
+
change
|
56
|
+
changed
|
57
|
+
channel
|
58
|
+
char
|
59
|
+
character
|
60
|
+
charset
|
61
|
+
check
|
62
|
+
checksum
|
63
|
+
cipher
|
64
|
+
class_origin
|
65
|
+
client
|
66
|
+
clone
|
67
|
+
close
|
68
|
+
coalesce
|
69
|
+
code
|
70
|
+
collate
|
71
|
+
collation
|
72
|
+
column
|
73
|
+
column_format
|
74
|
+
column_name
|
75
|
+
columns
|
76
|
+
comment
|
77
|
+
commit
|
78
|
+
committed
|
79
|
+
compact
|
80
|
+
completion
|
81
|
+
component
|
82
|
+
compressed
|
83
|
+
compression
|
84
|
+
concurrent
|
85
|
+
condition
|
86
|
+
connection
|
87
|
+
consistent
|
88
|
+
constraint
|
89
|
+
constraint_catalog
|
90
|
+
constraint_name
|
91
|
+
constraint_schema
|
92
|
+
contains
|
93
|
+
context
|
94
|
+
continue
|
95
|
+
convert
|
96
|
+
cpu
|
97
|
+
create
|
98
|
+
cross
|
99
|
+
cube
|
100
|
+
cume_dist
|
101
|
+
current
|
102
|
+
current_date
|
103
|
+
current_time
|
104
|
+
current_timestamp
|
105
|
+
current_user
|
106
|
+
cursor
|
107
|
+
cursor_name
|
108
|
+
data
|
109
|
+
database
|
110
|
+
databases
|
111
|
+
datafile
|
112
|
+
date
|
113
|
+
datetime
|
114
|
+
day
|
115
|
+
day_hour
|
116
|
+
day_microsecond
|
117
|
+
day_minute
|
118
|
+
day_second
|
119
|
+
deallocate
|
120
|
+
dec
|
121
|
+
decimal
|
122
|
+
declare
|
123
|
+
default
|
124
|
+
default_auth
|
125
|
+
definer
|
126
|
+
definition
|
127
|
+
delay_key_write
|
128
|
+
delayed
|
129
|
+
delete
|
130
|
+
dense_rank
|
131
|
+
des_key_file
|
132
|
+
desc
|
133
|
+
describe
|
134
|
+
description
|
135
|
+
deterministic
|
136
|
+
diagnostics
|
137
|
+
directory
|
138
|
+
disable
|
139
|
+
discard
|
140
|
+
disk
|
141
|
+
distinct
|
142
|
+
distinctrow
|
143
|
+
div
|
144
|
+
do
|
145
|
+
double
|
146
|
+
drop
|
147
|
+
dual
|
148
|
+
dumpfile
|
149
|
+
duplicate
|
150
|
+
dynamic
|
151
|
+
each
|
152
|
+
else
|
153
|
+
elseif
|
154
|
+
empty
|
155
|
+
enable
|
156
|
+
enclosed
|
157
|
+
encryption
|
158
|
+
end
|
159
|
+
ends
|
160
|
+
enforced
|
161
|
+
engine
|
162
|
+
engine_attribute
|
163
|
+
engines
|
164
|
+
enum
|
165
|
+
error
|
166
|
+
errors
|
167
|
+
escape
|
168
|
+
escaped
|
169
|
+
event
|
170
|
+
events
|
171
|
+
every
|
172
|
+
except
|
173
|
+
exchange
|
174
|
+
exclude
|
175
|
+
execute
|
176
|
+
exists
|
177
|
+
exit
|
178
|
+
expansion
|
179
|
+
expire
|
180
|
+
explain
|
181
|
+
export
|
182
|
+
extended
|
183
|
+
extent_size
|
184
|
+
factor
|
185
|
+
failed_login_attempts
|
186
|
+
false
|
187
|
+
fast
|
188
|
+
faults
|
189
|
+
fetch
|
190
|
+
fields
|
191
|
+
file
|
192
|
+
file_block_size
|
193
|
+
filter
|
194
|
+
finish
|
195
|
+
first
|
196
|
+
first_value
|
197
|
+
fixed
|
198
|
+
float
|
199
|
+
float4
|
200
|
+
float8
|
201
|
+
flush
|
202
|
+
following
|
203
|
+
follows
|
204
|
+
for
|
205
|
+
force
|
206
|
+
foreign
|
207
|
+
format
|
208
|
+
found
|
209
|
+
from
|
210
|
+
full
|
211
|
+
fulltext
|
212
|
+
function
|
213
|
+
general
|
214
|
+
generated
|
215
|
+
geomcollection
|
216
|
+
geometry
|
217
|
+
geometrycollection
|
218
|
+
get
|
219
|
+
get_format
|
220
|
+
get_master_public_key
|
221
|
+
get_source_public_key
|
222
|
+
global
|
223
|
+
grant
|
224
|
+
grants
|
225
|
+
group
|
226
|
+
group_replication
|
227
|
+
grouping
|
228
|
+
groups
|
229
|
+
gtid_only
|
230
|
+
handler
|
231
|
+
hash
|
232
|
+
having
|
233
|
+
help
|
234
|
+
high_priority
|
235
|
+
histogram
|
236
|
+
history
|
237
|
+
host
|
238
|
+
hosts
|
239
|
+
hour
|
240
|
+
hour_microsecond
|
241
|
+
hour_minute
|
242
|
+
hour_second
|
243
|
+
identified
|
244
|
+
if
|
245
|
+
ignore
|
246
|
+
ignore_server_ids
|
247
|
+
import
|
248
|
+
in
|
249
|
+
inactive
|
250
|
+
index
|
251
|
+
indexes
|
252
|
+
infile
|
253
|
+
initial
|
254
|
+
initial_size
|
255
|
+
initiate
|
256
|
+
inner
|
257
|
+
inout
|
258
|
+
insensitive
|
259
|
+
insert
|
260
|
+
insert_method
|
261
|
+
install
|
262
|
+
instance
|
263
|
+
int
|
264
|
+
int1
|
265
|
+
int2
|
266
|
+
int3
|
267
|
+
int4
|
268
|
+
int8
|
269
|
+
integer
|
270
|
+
interval
|
271
|
+
into
|
272
|
+
invisible
|
273
|
+
invoker
|
274
|
+
io
|
275
|
+
io_after_gtids
|
276
|
+
io_before_gtids
|
277
|
+
io_thread
|
278
|
+
ipc
|
279
|
+
is
|
280
|
+
isolation
|
281
|
+
issuer
|
282
|
+
iterate
|
283
|
+
join
|
284
|
+
json
|
285
|
+
json_table
|
286
|
+
json_value
|
287
|
+
key
|
288
|
+
key_block_size
|
289
|
+
keyring
|
290
|
+
keys
|
291
|
+
kill
|
292
|
+
lag
|
293
|
+
language
|
294
|
+
last
|
295
|
+
last_value
|
296
|
+
lateral
|
297
|
+
lead
|
298
|
+
leading
|
299
|
+
leave
|
300
|
+
leaves
|
301
|
+
left
|
302
|
+
less
|
303
|
+
level
|
304
|
+
like
|
305
|
+
limit
|
306
|
+
linear
|
307
|
+
lines
|
308
|
+
linestring
|
309
|
+
list
|
310
|
+
load
|
311
|
+
local
|
312
|
+
localtime
|
313
|
+
localtimestamp
|
314
|
+
lock
|
315
|
+
locked
|
316
|
+
locks
|
317
|
+
logfile
|
318
|
+
logs
|
319
|
+
long
|
320
|
+
longblob
|
321
|
+
longtext
|
322
|
+
loop
|
323
|
+
low_priority
|
324
|
+
master
|
325
|
+
master_auto_position
|
326
|
+
master_bind
|
327
|
+
master_compression_algorithms
|
328
|
+
master_connect_retry
|
329
|
+
master_delay
|
330
|
+
master_heartbeat_period
|
331
|
+
master_host
|
332
|
+
master_log_file
|
333
|
+
master_log_pos
|
334
|
+
master_password
|
335
|
+
master_port
|
336
|
+
master_public_key_path
|
337
|
+
master_retry_count
|
338
|
+
master_server_id
|
339
|
+
master_ssl
|
340
|
+
master_ssl_ca
|
341
|
+
master_ssl_capath
|
342
|
+
master_ssl_cert
|
343
|
+
master_ssl_cipher
|
344
|
+
master_ssl_crl
|
345
|
+
master_ssl_crlpath
|
346
|
+
master_ssl_key
|
347
|
+
master_ssl_verify_server_cert
|
348
|
+
master_tls_ciphersuites
|
349
|
+
master_tls_version
|
350
|
+
master_user
|
351
|
+
master_zstd_compression_level
|
352
|
+
match
|
353
|
+
max_connections_per_hour
|
354
|
+
max_queries_per_hour
|
355
|
+
max_rows
|
356
|
+
max_size
|
357
|
+
max_updates_per_hour
|
358
|
+
max_user_connections
|
359
|
+
maxvalue
|
360
|
+
medium
|
361
|
+
mediumblob
|
362
|
+
mediumint
|
363
|
+
mediumtext
|
364
|
+
member
|
365
|
+
memory
|
366
|
+
merge
|
367
|
+
message_text
|
368
|
+
microsecond
|
369
|
+
middleint
|
370
|
+
migrate
|
371
|
+
min_rows
|
372
|
+
minute
|
373
|
+
minute_microsecond
|
374
|
+
minute_second
|
375
|
+
mod
|
376
|
+
mode
|
377
|
+
modifies
|
378
|
+
modify
|
379
|
+
month
|
380
|
+
multilinestring
|
381
|
+
multipoint
|
382
|
+
multipolygon
|
383
|
+
mutex
|
384
|
+
mysql_errno
|
385
|
+
name
|
386
|
+
names
|
387
|
+
national
|
388
|
+
natural
|
389
|
+
nchar
|
390
|
+
ndb
|
391
|
+
ndbcluster
|
392
|
+
nested
|
393
|
+
network_namespace
|
394
|
+
never
|
395
|
+
new
|
396
|
+
next
|
397
|
+
no
|
398
|
+
no_wait
|
399
|
+
no_write_to_binlog
|
400
|
+
nodegroup
|
401
|
+
none
|
402
|
+
not
|
403
|
+
nowait
|
404
|
+
nth_value
|
405
|
+
ntile
|
406
|
+
null
|
407
|
+
nulls
|
408
|
+
number
|
409
|
+
numeric
|
410
|
+
nvarchar
|
411
|
+
of
|
412
|
+
off
|
413
|
+
offset
|
414
|
+
oj
|
415
|
+
old
|
416
|
+
on
|
417
|
+
one
|
418
|
+
only
|
419
|
+
open
|
420
|
+
optimize
|
421
|
+
optimizer_costs
|
422
|
+
option
|
423
|
+
optional
|
424
|
+
optionally
|
425
|
+
options
|
426
|
+
or
|
427
|
+
order
|
428
|
+
ordinality
|
429
|
+
organization
|
430
|
+
others
|
431
|
+
out
|
432
|
+
outer
|
433
|
+
outfile
|
434
|
+
over
|
435
|
+
owner
|
436
|
+
pack_keys
|
437
|
+
page
|
438
|
+
parser
|
439
|
+
partial
|
440
|
+
partition
|
441
|
+
partitioning
|
442
|
+
partitions
|
443
|
+
password
|
444
|
+
password_lock_time
|
445
|
+
path
|
446
|
+
percent_rank
|
447
|
+
persist
|
448
|
+
persist_only
|
449
|
+
phase
|
450
|
+
plugin
|
451
|
+
plugin_dir
|
452
|
+
plugins
|
453
|
+
point
|
454
|
+
polygon
|
455
|
+
port
|
456
|
+
precedes
|
457
|
+
preceding
|
458
|
+
precision
|
459
|
+
prepare
|
460
|
+
preserve
|
461
|
+
prev
|
462
|
+
primary
|
463
|
+
privilege_checks_user
|
464
|
+
privileges
|
465
|
+
procedure
|
466
|
+
process
|
467
|
+
processlist
|
468
|
+
profile
|
469
|
+
profiles
|
470
|
+
proxy
|
471
|
+
purge
|
472
|
+
quarter
|
473
|
+
query
|
474
|
+
quick
|
475
|
+
random
|
476
|
+
range
|
477
|
+
rank
|
478
|
+
read
|
479
|
+
read_only
|
480
|
+
read_write
|
481
|
+
reads
|
482
|
+
real
|
483
|
+
rebuild
|
484
|
+
recover
|
485
|
+
recursive
|
486
|
+
redo_buffer_size
|
487
|
+
redofile
|
488
|
+
redundant
|
489
|
+
reference
|
490
|
+
references
|
491
|
+
regexp
|
492
|
+
registration
|
493
|
+
relay
|
494
|
+
relay_log_file
|
495
|
+
relay_log_pos
|
496
|
+
relay_thread
|
497
|
+
relaylog
|
498
|
+
release
|
499
|
+
reload
|
500
|
+
remote
|
501
|
+
remove
|
502
|
+
rename
|
503
|
+
reorganize
|
504
|
+
repair
|
505
|
+
repeat
|
506
|
+
repeatable
|
507
|
+
replace
|
508
|
+
replica
|
509
|
+
replicas
|
510
|
+
replicate_do_db
|
511
|
+
replicate_do_table
|
512
|
+
replicate_ignore_db
|
513
|
+
replicate_ignore_table
|
514
|
+
replicate_rewrite_db
|
515
|
+
replicate_wild_do_table
|
516
|
+
replicate_wild_ignore_table
|
517
|
+
replication
|
518
|
+
require
|
519
|
+
require_row_format
|
520
|
+
reset
|
521
|
+
resignal
|
522
|
+
resource
|
523
|
+
respect
|
524
|
+
restart
|
525
|
+
restore
|
526
|
+
restrict
|
527
|
+
resume
|
528
|
+
retain
|
529
|
+
return
|
530
|
+
returned_sqlstate
|
531
|
+
returning
|
532
|
+
returns
|
533
|
+
reuse
|
534
|
+
reverse
|
535
|
+
revoke
|
536
|
+
right
|
537
|
+
rlike
|
538
|
+
role
|
539
|
+
rollback
|
540
|
+
rollup
|
541
|
+
rotate
|
542
|
+
routine
|
543
|
+
row
|
544
|
+
row_count
|
545
|
+
row_format
|
546
|
+
row_number
|
547
|
+
rows
|
548
|
+
rtree
|
549
|
+
savepoint
|
550
|
+
schedule
|
551
|
+
schema
|
552
|
+
schema_name
|
553
|
+
schemas
|
554
|
+
second
|
555
|
+
second_microsecond
|
556
|
+
secondary
|
557
|
+
secondary_engine
|
558
|
+
secondary_engine_attribute
|
559
|
+
secondary_load
|
560
|
+
secondary_unload
|
561
|
+
security
|
562
|
+
select
|
563
|
+
sensitive
|
564
|
+
separator
|
565
|
+
serial
|
566
|
+
serializable
|
567
|
+
server
|
568
|
+
session
|
569
|
+
set
|
570
|
+
share
|
571
|
+
show
|
572
|
+
shutdown
|
573
|
+
signal
|
574
|
+
signed
|
575
|
+
simple
|
576
|
+
skip
|
577
|
+
slave
|
578
|
+
slow
|
579
|
+
smallint
|
580
|
+
snapshot
|
581
|
+
socket
|
582
|
+
some
|
583
|
+
soname
|
584
|
+
sounds
|
585
|
+
source
|
586
|
+
source_auto_position
|
587
|
+
source_bind
|
588
|
+
source_compression_algorithms
|
589
|
+
source_connect_retry
|
590
|
+
source_delay
|
591
|
+
source_heartbeat_period
|
592
|
+
source_host
|
593
|
+
source_log_file
|
594
|
+
source_log_pos
|
595
|
+
source_password
|
596
|
+
source_port
|
597
|
+
source_public_key_path
|
598
|
+
source_retry_count
|
599
|
+
source_ssl
|
600
|
+
source_ssl_ca
|
601
|
+
source_ssl_capath
|
602
|
+
source_ssl_cert
|
603
|
+
source_ssl_cipher
|
604
|
+
source_ssl_crl
|
605
|
+
source_ssl_crlpath
|
606
|
+
source_ssl_key
|
607
|
+
source_ssl_verify_server_cert
|
608
|
+
source_tls_ciphersuites
|
609
|
+
source_tls_version
|
610
|
+
source_user
|
611
|
+
source_zstd_compression_level
|
612
|
+
spatial
|
613
|
+
specific
|
614
|
+
sql
|
615
|
+
sql_after_gtids
|
616
|
+
sql_after_mts_gaps
|
617
|
+
sql_before_gtids
|
618
|
+
sql_big_result
|
619
|
+
sql_buffer_result
|
620
|
+
sql_cache
|
621
|
+
sql_calc_found_rows
|
622
|
+
sql_no_cache
|
623
|
+
sql_small_result
|
624
|
+
sql_thread
|
625
|
+
sql_tsi_day
|
626
|
+
sql_tsi_hour
|
627
|
+
sql_tsi_minute
|
628
|
+
sql_tsi_month
|
629
|
+
sql_tsi_quarter
|
630
|
+
sql_tsi_second
|
631
|
+
sql_tsi_week
|
632
|
+
sql_tsi_year
|
633
|
+
sqlexception
|
634
|
+
sqlstate
|
635
|
+
sqlwarning
|
636
|
+
srid
|
637
|
+
ssl
|
638
|
+
stacked
|
639
|
+
start
|
640
|
+
starting
|
641
|
+
starts
|
642
|
+
stats_auto_recalc
|
643
|
+
stats_persistent
|
644
|
+
stats_sample_pages
|
645
|
+
status
|
646
|
+
stop
|
647
|
+
storage
|
648
|
+
stored
|
649
|
+
straight_join
|
650
|
+
stream
|
651
|
+
string
|
652
|
+
subclass_origin
|
653
|
+
subject
|
654
|
+
subpartition
|
655
|
+
subpartitions
|
656
|
+
super
|
657
|
+
suspend
|
658
|
+
swaps
|
659
|
+
switches
|
660
|
+
system
|
661
|
+
table
|
662
|
+
table_checksum
|
663
|
+
table_name
|
664
|
+
tables
|
665
|
+
tablespace
|
666
|
+
temporary
|
667
|
+
temptable
|
668
|
+
terminated
|
669
|
+
text
|
670
|
+
than
|
671
|
+
then
|
672
|
+
thread_priority
|
673
|
+
ties
|
674
|
+
time
|
675
|
+
timestamp
|
676
|
+
timestampadd
|
677
|
+
timestampdiff
|
678
|
+
tinyblob
|
679
|
+
tinyint
|
680
|
+
tinytext
|
681
|
+
tls
|
682
|
+
to
|
683
|
+
trailing
|
684
|
+
transaction
|
685
|
+
trigger
|
686
|
+
triggers
|
687
|
+
true
|
688
|
+
truncate
|
689
|
+
type
|
690
|
+
types
|
691
|
+
unbounded
|
692
|
+
uncommitted
|
693
|
+
undefined
|
694
|
+
undo
|
695
|
+
undo_buffer_size
|
696
|
+
undofile
|
697
|
+
unicode
|
698
|
+
uninstall
|
699
|
+
union
|
700
|
+
unique
|
701
|
+
unknown
|
702
|
+
unlock
|
703
|
+
unregister
|
704
|
+
unsigned
|
705
|
+
until
|
706
|
+
update
|
707
|
+
upgrade
|
708
|
+
usage
|
709
|
+
use
|
710
|
+
use_frm
|
711
|
+
user
|
712
|
+
user_resources
|
713
|
+
using
|
714
|
+
utc_date
|
715
|
+
utc_time
|
716
|
+
utc_timestamp
|
717
|
+
validation
|
718
|
+
value
|
719
|
+
values
|
720
|
+
varbinary
|
721
|
+
varchar
|
722
|
+
varcharacter
|
723
|
+
variables
|
724
|
+
varying
|
725
|
+
vcpu
|
726
|
+
view
|
727
|
+
virtual
|
728
|
+
visible
|
729
|
+
wait
|
730
|
+
warnings
|
731
|
+
week
|
732
|
+
weight_string
|
733
|
+
when
|
734
|
+
where
|
735
|
+
while
|
736
|
+
window
|
737
|
+
with
|
738
|
+
without
|
739
|
+
work
|
740
|
+
wrapper
|
741
|
+
write
|
742
|
+
x509
|
743
|
+
xa
|
744
|
+
xid
|
745
|
+
xml
|
746
|
+
xor
|
747
|
+
year
|
748
|
+
year_month
|
749
|
+
zerofill
|
750
|
+
zone
|
@@ -0,0 +1,249 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'set'
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Cop
|
7
|
+
module Sevencop
|
8
|
+
# Avoid using MySQL reserved words as identifiers.
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# # bad
|
12
|
+
# # NOTE: `role` is a reserved word in MySQL.
|
13
|
+
# add_column :users, :role, :string
|
14
|
+
#
|
15
|
+
# # good
|
16
|
+
# add_column :users, :some_other_good_name, :string
|
17
|
+
class RailsMigrationReservedWordMysql < RuboCop::Cop::Base
|
18
|
+
COLUMN_TYPE_METHOD_NAMES = ::Set.new(
|
19
|
+
%i[
|
20
|
+
bigint
|
21
|
+
binary
|
22
|
+
blob
|
23
|
+
boolean
|
24
|
+
date
|
25
|
+
datetime
|
26
|
+
decimal
|
27
|
+
float
|
28
|
+
integer
|
29
|
+
numeric
|
30
|
+
primary_key
|
31
|
+
string
|
32
|
+
text
|
33
|
+
time
|
34
|
+
]
|
35
|
+
).freeze
|
36
|
+
|
37
|
+
MSG = 'Avoid using MySQL reserved words as identifiers.'
|
38
|
+
|
39
|
+
# Obtained from https://dev.mysql.com/doc/refman/8.0/en/keywords.html.
|
40
|
+
PATH_TO_RESERVED_WORDS_FILE = File.expand_path(
|
41
|
+
'../../../../data/reserved_words_mysql.txt',
|
42
|
+
__dir__
|
43
|
+
).freeze
|
44
|
+
|
45
|
+
RESTRICT_ON_SEND = [
|
46
|
+
:add_column,
|
47
|
+
:add_index,
|
48
|
+
:add_reference,
|
49
|
+
:create_join_table,
|
50
|
+
:create_table,
|
51
|
+
:rename,
|
52
|
+
:rename_column,
|
53
|
+
:rename_index,
|
54
|
+
:rename_table,
|
55
|
+
*COLUMN_TYPE_METHOD_NAMES
|
56
|
+
].freeze
|
57
|
+
|
58
|
+
class << self
|
59
|
+
# @return [Array<String>]
|
60
|
+
def reserved_words
|
61
|
+
@reserved_words ||= ::Set.new(
|
62
|
+
::File.read(PATH_TO_RESERVED_WORDS_FILE).split("\n")
|
63
|
+
).freeze
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# @param node [RuboCop::AST::DefNode]
|
68
|
+
# @return [void]
|
69
|
+
def on_send(node)
|
70
|
+
offended_identifier_nodes_from(node).each do |identifier_node|
|
71
|
+
add_offense(identifier_node)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
# @!method index_name_option_from_add_index(node)
|
78
|
+
# @param node [RuboCop::AST::SendNode]
|
79
|
+
# @return [RuboCop::AST::Node, nil]
|
80
|
+
def_node_matcher :index_name_option_from_add_index, <<~PATTERN
|
81
|
+
(send
|
82
|
+
nil?
|
83
|
+
:add_index
|
84
|
+
_
|
85
|
+
_
|
86
|
+
(hash
|
87
|
+
<
|
88
|
+
(pair
|
89
|
+
(sym :name)
|
90
|
+
$_
|
91
|
+
)
|
92
|
+
>
|
93
|
+
...
|
94
|
+
)
|
95
|
+
)
|
96
|
+
PATTERN
|
97
|
+
|
98
|
+
# @!method index_name_option_from_add_reference(node)
|
99
|
+
# @param node [RuboCop::AST::SendNode]
|
100
|
+
# @return [RuboCop::AST::Node, nil]
|
101
|
+
def_node_matcher :index_name_option_from_add_reference, <<~PATTERN
|
102
|
+
(send
|
103
|
+
nil?
|
104
|
+
:add_reference
|
105
|
+
_
|
106
|
+
_
|
107
|
+
(hash
|
108
|
+
<
|
109
|
+
(pair
|
110
|
+
(sym :index)
|
111
|
+
(hash
|
112
|
+
<
|
113
|
+
(pair
|
114
|
+
(sym :name)
|
115
|
+
$_
|
116
|
+
)
|
117
|
+
>
|
118
|
+
...
|
119
|
+
)
|
120
|
+
)
|
121
|
+
>
|
122
|
+
...
|
123
|
+
)
|
124
|
+
)
|
125
|
+
PATTERN
|
126
|
+
|
127
|
+
# @!method index_name_option_from_column_type(node)
|
128
|
+
# @param node [RuboCop::AST::SendNode]
|
129
|
+
# @return [RuboCop::AST::Node, nil]
|
130
|
+
def_node_matcher :index_name_option_from_column_type, <<~PATTERN
|
131
|
+
(send
|
132
|
+
(lvar _)
|
133
|
+
COLUMN_TYPE_METHOD_NAMES
|
134
|
+
_
|
135
|
+
(hash
|
136
|
+
<
|
137
|
+
(pair
|
138
|
+
(sym :index)
|
139
|
+
(hash
|
140
|
+
<
|
141
|
+
(pair
|
142
|
+
(sym :name)
|
143
|
+
$_
|
144
|
+
)
|
145
|
+
...
|
146
|
+
>
|
147
|
+
)
|
148
|
+
)
|
149
|
+
...
|
150
|
+
>
|
151
|
+
)
|
152
|
+
)
|
153
|
+
PATTERN
|
154
|
+
|
155
|
+
# @!method table_name_option_from(node)
|
156
|
+
# @param node [RuboCop::AST::SendNode]
|
157
|
+
# @return [RuboCop::AST::Node, nil]
|
158
|
+
def_node_matcher :table_name_option_from, <<~PATTERN
|
159
|
+
(send
|
160
|
+
nil?
|
161
|
+
:create_join_table
|
162
|
+
_
|
163
|
+
_
|
164
|
+
(hash
|
165
|
+
<
|
166
|
+
(pair
|
167
|
+
(sym :table_name)
|
168
|
+
$_
|
169
|
+
)
|
170
|
+
...
|
171
|
+
>
|
172
|
+
)
|
173
|
+
)
|
174
|
+
PATTERN
|
175
|
+
|
176
|
+
# @param node [RuboCop::AST::SendNode]
|
177
|
+
# @return [Array<RuboCop::AST::Node>]
|
178
|
+
def identifier_column_name_nodes_from(node)
|
179
|
+
case node.method_name
|
180
|
+
when :add_column, :rename
|
181
|
+
[node.arguments[1]]
|
182
|
+
when :rename_column
|
183
|
+
[node.arguments[2]]
|
184
|
+
when *COLUMN_TYPE_METHOD_NAMES
|
185
|
+
[node.arguments[0]]
|
186
|
+
else
|
187
|
+
[]
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# @param node [RuboCop::AST::SendNode]
|
192
|
+
# @return [Array<RuboCop::AST::Node>]
|
193
|
+
def identifier_index_name_nodes_from(node)
|
194
|
+
case node.method_name
|
195
|
+
when :add_index
|
196
|
+
[index_name_option_from_add_index(node)].compact
|
197
|
+
when :add_reference
|
198
|
+
[index_name_option_from_add_reference(node)].compact
|
199
|
+
when :rename_index
|
200
|
+
[node.arguments[2]]
|
201
|
+
when *COLUMN_TYPE_METHOD_NAMES
|
202
|
+
[index_name_option_from_column_type(node)].compact
|
203
|
+
else
|
204
|
+
[]
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
# @param node [RuboCop::AST::SendNode]
|
209
|
+
# @return [Array<RuboCop::AST::Node>]
|
210
|
+
def identifier_nodes_from(node)
|
211
|
+
identifier_table_name_nodes_from(node) +
|
212
|
+
identifier_column_name_nodes_from(node) +
|
213
|
+
identifier_index_name_nodes_from(node)
|
214
|
+
end
|
215
|
+
|
216
|
+
# @param node [RuboCop::AST::SendNode]
|
217
|
+
# @return [Array<RuboCop::AST::Node>]
|
218
|
+
def identifier_table_name_nodes_from(node)
|
219
|
+
case node.method_name
|
220
|
+
when :create_join_table
|
221
|
+
[table_name_option_from(node)].compact
|
222
|
+
when :create_table
|
223
|
+
[node.arguments[0]]
|
224
|
+
when :rename_table
|
225
|
+
[node.arguments[1]]
|
226
|
+
else
|
227
|
+
[]
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
# @param node [RuboCop::AST::Node]
|
232
|
+
# @return [Array<RuboCop::AST::Node>]
|
233
|
+
def offended_identifier_nodes_from(node)
|
234
|
+
identifier_nodes_from(node).select do |identifier_node|
|
235
|
+
reserved_word_identifier_node?(identifier_node)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
# @param node [RuboCop::AST::Node]
|
240
|
+
# @return [Boolean]
|
241
|
+
def reserved_word_identifier_node?(node)
|
242
|
+
return false unless node.respond_to?(:value)
|
243
|
+
|
244
|
+
self.class.reserved_words.include?(node.value.to_s)
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
data/lib/sevencop/version.rb
CHANGED
data/lib/sevencop.rb
CHANGED
@@ -12,6 +12,7 @@ require_relative 'rubocop/cop/sevencop/method_definition_keyword_argument_ordere
|
|
12
12
|
require_relative 'rubocop/cop/sevencop/method_definition_ordered'
|
13
13
|
require_relative 'rubocop/cop/sevencop/rails_belongs_to_optional'
|
14
14
|
require_relative 'rubocop/cop/sevencop/rails_inferred_spec_type'
|
15
|
+
require_relative 'rubocop/cop/sevencop/rails_migration_reserved_word_mysql'
|
15
16
|
require_relative 'rubocop/cop/sevencop/rails_order_field'
|
16
17
|
require_relative 'rubocop/cop/sevencop/rails_uniqueness_validator_explicit_case_sensitivity'
|
17
18
|
require_relative 'rubocop/cop/sevencop/rails_where_not'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sevencop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -41,6 +41,7 @@ files:
|
|
41
41
|
- README.md
|
42
42
|
- Rakefile
|
43
43
|
- config/default.yml
|
44
|
+
- data/reserved_words_mysql.txt
|
44
45
|
- lib/rubocop/cop/sevencop/autoload_ordered.rb
|
45
46
|
- lib/rubocop/cop/sevencop/hash_element_ordered.rb
|
46
47
|
- lib/rubocop/cop/sevencop/method_definition_arguments_multiline.rb
|
@@ -49,6 +50,7 @@ files:
|
|
49
50
|
- lib/rubocop/cop/sevencop/method_definition_ordered.rb
|
50
51
|
- lib/rubocop/cop/sevencop/rails_belongs_to_optional.rb
|
51
52
|
- lib/rubocop/cop/sevencop/rails_inferred_spec_type.rb
|
53
|
+
- lib/rubocop/cop/sevencop/rails_migration_reserved_word_mysql.rb
|
52
54
|
- lib/rubocop/cop/sevencop/rails_order_field.rb
|
53
55
|
- lib/rubocop/cop/sevencop/rails_uniqueness_validator_explicit_case_sensitivity.rb
|
54
56
|
- lib/rubocop/cop/sevencop/rails_where_not.rb
|