sevencop 0.46.0 → 0.47.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f3da941ce26e523263ae349b642de04f08c6fafb25c65ee87a1552700336a59
4
- data.tar.gz: 57c17da50da92c2fc735ea23b1acaf216885069afc651a14386a288ce93f400c
3
+ metadata.gz: db46ba38fdc0d8ef6df4fb827b79f7220c892eec33ff114f5e677111823f1efc
4
+ data.tar.gz: 4d46e8333f113a6470c2d36b3860ee343a8926d5f8653b9943c85eb317f6e61d
5
5
  SHA512:
6
- metadata.gz: c5b76d4613a1d575720c9aa07cc3253608ef19cd0cf9e7c25fedebbb8355d0af46a2701b3282147b4058646b4ef9123f7c39b34eb217a53cadd93a6947556fea
7
- data.tar.gz: 139c3d03d5ed0441d78564bbe21e7037273bab082e72c47c530e631869f4654fbc070b31a6d82a194c76f98a27ac5c8db5170993a584bec0f4a0f87656c7e4f0
6
+ metadata.gz: 5c3542c01fbfc87e90e46f99b69f51375ec2ba0190c1c4050d0c5648bb667a48e7be59fd776f682c92a2e6f4c113685b7c6c766495f5620c05f6de16b8ed0fd8
7
+ data.tar.gz: 86fd40ac5d566774269fd2a96d93ee62ced6c0df556b8cc76879e04e68ed3919070787092930ed897e133fd7c6680d8a56d429d370ad27f8d9c6be1fcfe89ad8
data/.rubocop.yml CHANGED
@@ -50,6 +50,9 @@ RSpec/SpecFilePathFormat:
50
50
  Sevencop/AutoloadOrdered:
51
51
  Enabled: true
52
52
 
53
+ Sevencop/BundlerGemGroupNameOrdered:
54
+ Enabled: true
55
+
53
56
  Sevencop/BundlerGemGroupOrdered:
54
57
  Enabled: true
55
58
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sevencop (0.46.0)
4
+ sevencop (0.47.0)
5
5
  activesupport
6
6
  rubocop
7
7
 
@@ -33,7 +33,7 @@ GEM
33
33
  json (2.7.2)
34
34
  language_server-protocol (3.17.0.3)
35
35
  logger (1.6.2)
36
- minitest (5.25.2)
36
+ minitest (5.25.4)
37
37
  parallel (1.26.3)
38
38
  parser (3.3.5.0)
39
39
  ast (~> 2.4.1)
data/README.md CHANGED
@@ -29,6 +29,7 @@ Note that all cops are `Enabled: false` by default.
29
29
  ## Cops
30
30
 
31
31
  - [Sevencop/AutoloadOrdered](lib/rubocop/cop/sevencop/autoload_ordered.rb)
32
+ - [Sevencop/BundlerGemGroupNameOrdered](lib/rubocop/cop/sevencop/bundler_gem_group_name_ordered.rb)
32
33
  - [Sevencop/BundlerGemGroupOrdered](lib/rubocop/cop/sevencop/bundler_gem_group_ordered.rb)
33
34
  - [Sevencop/HashElementOrdered](lib/rubocop/cop/sevencop/hash_element_ordered.rb)
34
35
  - [Sevencop/MapMethodChain](lib/rubocop/cop/sevencop/map_method_chain.rb)
data/config/default.yml CHANGED
@@ -4,6 +4,16 @@ Sevencop/AutoloadOrdered:
4
4
  Enabled: false
5
5
  Safe: false
6
6
 
7
+ Sevencop/BundlerGemGroupNameOrdered:
8
+ Description: |
9
+ Sort `group` names in alphabetical order.
10
+ Enabled: false
11
+ Safe: false
12
+ Include:
13
+ - '**/*.gemfile'
14
+ - '**/Gemfile'
15
+ - '**/gems.rb'
16
+
7
17
  Sevencop/BundlerGemGroupOrdered:
8
18
  Description: |
9
19
  Sort `group` in alphabetical order.
@@ -14,6 +24,7 @@ Sevencop/BundlerGemGroupOrdered:
14
24
  - '**/Gemfile'
15
25
  - '**/gems.rb'
16
26
 
27
+
17
28
  Sevencop/HashElementOrdered:
18
29
  Description: |
19
30
  Sort Hash elements by key.
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Sevencop
6
+ # Sort `group` names in alphabetical order.
7
+ #
8
+ # @example
9
+ # # bad
10
+ # group :test, :development do
11
+ # gem 'rspec-rails'
12
+ # end
13
+ #
14
+ # # good
15
+ # group :development, :test do
16
+ # gem 'rspec-rails'
17
+ # end
18
+ class BundlerGemGroupNameOrdered < Base
19
+ extend AutoCorrector
20
+
21
+ include RangeHelp
22
+
23
+ include ::Sevencop::CopConcerns::Ordered
24
+
25
+ MSG = 'Sort `group` names in alphabetical order.'
26
+
27
+ RESTRICT_ON_SEND = %i[
28
+ group
29
+ ].freeze
30
+
31
+ # @param [RuboCop::AST::SendNode] node
32
+ # @return [void]
33
+ def on_send(node)
34
+ node.arguments.select(&:sym_type?).each do |argument|
35
+ previous_older_sibling = find_previous_older_sibling(argument)
36
+ next unless previous_older_sibling
37
+
38
+ add_offense(argument) do |corrector|
39
+ corrector.swap(previous_older_sibling, argument)
40
+ end
41
+ end
42
+ end
43
+
44
+ private
45
+
46
+ # @param [RuboCop::AST::SymbolNode] node
47
+ # @return [RuboCop::AST::Node, nil]
48
+ def find_previous_older_sibling(node)
49
+ node.left_siblings.grep(::RuboCop::AST::Node).reverse.find do |sibling|
50
+ node.source < sibling.source
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sevencop
4
- VERSION = '0.46.0'
4
+ VERSION = '0.47.0'
5
5
  end
data/lib/sevencop.rb CHANGED
@@ -5,6 +5,7 @@ require_relative 'sevencop/rubocop_extension'
5
5
  require_relative 'sevencop/version'
6
6
 
7
7
  require_relative 'rubocop/cop/sevencop/autoload_ordered'
8
+ require_relative 'rubocop/cop/sevencop/bundler_gem_group_name_ordered'
8
9
  require_relative 'rubocop/cop/sevencop/bundler_gem_group_ordered'
9
10
  require_relative 'rubocop/cop/sevencop/hash_element_ordered'
10
11
  require_relative 'rubocop/cop/sevencop/map_method_chain'
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.46.0
4
+ version: 0.47.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: 2024-12-02 00:00:00.000000000 Z
11
+ date: 2024-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -55,8 +55,8 @@ files:
55
55
  - README.md
56
56
  - Rakefile
57
57
  - config/default.yml
58
- - data/reserved_words_mysql.txt
59
58
  - lib/rubocop/cop/sevencop/autoload_ordered.rb
59
+ - lib/rubocop/cop/sevencop/bundler_gem_group_name_ordered.rb
60
60
  - lib/rubocop/cop/sevencop/bundler_gem_group_ordered.rb
61
61
  - lib/rubocop/cop/sevencop/hash_element_ordered.rb
62
62
  - lib/rubocop/cop/sevencop/map_method_chain.rb
@@ -1,750 +0,0 @@
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