nxt_cop 2.2.0 → 2.4.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/.circleci/config.yml +37 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +19 -1
- data/default.yml +2 -265
- data/lib/nxt_cop/version.rb +1 -1
- data/nxt_cop.gemspec +2 -0
- metadata +32 -3
- data/custom_cops/nxt_core/rails/missing_logger_include.rb +0 -39
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2b196848eede14a56c47b9828efd5b5f6f5fb47f70cc259aa509536dd683e71e
|
|
4
|
+
data.tar.gz: e967860b4d70d8bd00abf0127c04216b61d216e71c8c1a631a055b83abd82957
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c81ef302a52a1acb9facb68fe1ec2a695ffaa28d95e5a671fc7ac3444304a43fc354172b72ae680a46ef90653b7ff37f7239ae4220e49a66afcd09e8bced84c4
|
|
7
|
+
data.tar.gz: 2419798b3be96e052a18cce5af279952015c00057ed66b02d9c987cb535ad4d5c58e4c24b836612ae34d474c927db976a74f170b2326c402949369675a51640f
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# See https://circleci.com/docs/2.0/language-ruby/ for more details
|
|
2
|
+
|
|
3
|
+
version: 2.1
|
|
4
|
+
|
|
5
|
+
orbs:
|
|
6
|
+
ruby: circleci/ruby@2.0.1
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
checks:
|
|
10
|
+
parallelism: 1
|
|
11
|
+
resource_class: small
|
|
12
|
+
docker:
|
|
13
|
+
- image: cimg/ruby:3.3.0
|
|
14
|
+
steps:
|
|
15
|
+
- checkout
|
|
16
|
+
- ruby/install-deps:
|
|
17
|
+
key: gems-v1
|
|
18
|
+
include-branch-in-cache-key: false
|
|
19
|
+
# - ruby/rubocop-check
|
|
20
|
+
- run:
|
|
21
|
+
name: RSpec Tests
|
|
22
|
+
command: |-
|
|
23
|
+
bundle exec rspec --format RspecJunitFormatter \
|
|
24
|
+
--out /tmp/test-results/rspec/results.xml --format progress
|
|
25
|
+
# actually not necessary for test results to be collected, but these files
|
|
26
|
+
# won't show up in the web UI otherwise
|
|
27
|
+
- store_artifacts:
|
|
28
|
+
path: /tmp/rspec/
|
|
29
|
+
destination: rspec
|
|
30
|
+
- store_test_results:
|
|
31
|
+
path: /tmp/rspec/
|
|
32
|
+
|
|
33
|
+
workflows:
|
|
34
|
+
version: 2
|
|
35
|
+
checks:
|
|
36
|
+
jobs:
|
|
37
|
+
- checks
|
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require spec_helper
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
# v2.4.0 2024-02-19
|
|
2
|
+
## What's Changed
|
|
3
|
+
- Add tests for custom cops
|
|
4
|
+
- Removed `Rails/MissingLoggerInclude` due to maintenance burden
|
|
5
|
+
|
|
6
|
+
# v2.3.0 2024-02-09
|
|
7
|
+
## What's Changed
|
|
8
|
+
- Tree shake the config (no rules change)
|
|
9
|
+
|
|
1
10
|
# v2.2.0 2024-01-30
|
|
2
11
|
## What's Changed
|
|
3
12
|
- Add rubocop-factory_bot
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
nxt_cop (2.
|
|
4
|
+
nxt_cop (2.4.0)
|
|
5
5
|
rubocop (~> 1.60.0)
|
|
6
6
|
rubocop-rails (~> 2.8)
|
|
7
7
|
rubocop-rspec (~> 2.12)
|
|
@@ -24,6 +24,7 @@ GEM
|
|
|
24
24
|
bigdecimal (3.1.6)
|
|
25
25
|
concurrent-ruby (1.2.3)
|
|
26
26
|
connection_pool (2.4.1)
|
|
27
|
+
diff-lcs (1.5.1)
|
|
27
28
|
drb (2.2.0)
|
|
28
29
|
ruby2_keywords
|
|
29
30
|
i18n (1.14.1)
|
|
@@ -42,6 +43,21 @@ GEM
|
|
|
42
43
|
rake (13.1.0)
|
|
43
44
|
regexp_parser (2.9.0)
|
|
44
45
|
rexml (3.2.6)
|
|
46
|
+
rspec (3.13.0)
|
|
47
|
+
rspec-core (~> 3.13.0)
|
|
48
|
+
rspec-expectations (~> 3.13.0)
|
|
49
|
+
rspec-mocks (~> 3.13.0)
|
|
50
|
+
rspec-core (3.13.0)
|
|
51
|
+
rspec-support (~> 3.13.0)
|
|
52
|
+
rspec-expectations (3.13.0)
|
|
53
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
54
|
+
rspec-support (~> 3.13.0)
|
|
55
|
+
rspec-mocks (3.13.0)
|
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
57
|
+
rspec-support (~> 3.13.0)
|
|
58
|
+
rspec-support (3.13.0)
|
|
59
|
+
rspec_junit_formatter (0.6.0)
|
|
60
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
|
45
61
|
rubocop (1.60.2)
|
|
46
62
|
json (~> 2.3)
|
|
47
63
|
language_server-protocol (>= 3.17.0)
|
|
@@ -81,6 +97,8 @@ DEPENDENCIES
|
|
|
81
97
|
bundler (~> 2.1)
|
|
82
98
|
nxt_cop!
|
|
83
99
|
rake (~> 13.0)
|
|
100
|
+
rspec
|
|
101
|
+
rspec_junit_formatter
|
|
84
102
|
|
|
85
103
|
BUNDLED WITH
|
|
86
104
|
2.1.4
|
data/default.yml
CHANGED
|
@@ -3,7 +3,6 @@ require:
|
|
|
3
3
|
- rubocop-rails
|
|
4
4
|
- rubocop-rspec
|
|
5
5
|
- ./custom_cops/nxt_core/rails/use_of_rails_logger.rb
|
|
6
|
-
- ./custom_cops/nxt_core/rails/missing_logger_include.rb
|
|
7
6
|
|
|
8
7
|
inherit_mode:
|
|
9
8
|
merge:
|
|
@@ -12,9 +11,6 @@ inherit_mode:
|
|
|
12
11
|
|
|
13
12
|
Rails/UseOfRailsLogger:
|
|
14
13
|
Description: "Custom Getsafe cop to ensure the correct logger is used"
|
|
15
|
-
Rails/MissingLoggerInclude:
|
|
16
|
-
Description: "Custom Getsafe cop to find missing `include` statements when using our custom logger"
|
|
17
|
-
SafeAutoCorrect: false
|
|
18
14
|
|
|
19
15
|
AllCops:
|
|
20
16
|
Exclude:
|
|
@@ -30,26 +26,17 @@ AllCops:
|
|
|
30
26
|
DisabledByDefault: false
|
|
31
27
|
NewCops: disable # to avoid warnings. TODO: remove this setting and add new cops from the warning.
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
# but for some reason 'DisableByDefault' is set to 'true' above.
|
|
35
|
-
# Removing this configuration leads to a lot of violations triggered
|
|
36
|
-
# by other cops that are not auto-correctable.
|
|
29
|
+
|
|
37
30
|
Layout/ArgumentAlignment:
|
|
38
31
|
EnforcedStyle: with_fixed_indentation
|
|
39
32
|
Layout/ArrayAlignment:
|
|
40
33
|
EnforcedStyle: with_fixed_indentation
|
|
41
|
-
Layout/HashAlignment:
|
|
42
|
-
EnforcedHashRocketStyle: key
|
|
43
34
|
Layout/ParameterAlignment:
|
|
44
35
|
EnforcedStyle: with_fixed_indentation
|
|
45
36
|
Layout/MultilineArrayLineBreaks:
|
|
46
37
|
Enabled: true
|
|
47
|
-
Layout/MultilineBlockLayout:
|
|
48
|
-
Enabled: true
|
|
49
38
|
Layout/MultilineHashKeyLineBreaks:
|
|
50
39
|
Enabled: true
|
|
51
|
-
Layout/MultilineHashBraceLayout:
|
|
52
|
-
Enabled: true
|
|
53
40
|
Layout/FirstMethodArgumentLineBreak:
|
|
54
41
|
Enabled: true
|
|
55
42
|
Layout/MultilineMethodCallBraceLayout:
|
|
@@ -74,120 +61,22 @@ Layout/FirstArrayElementIndentation:
|
|
|
74
61
|
EnforcedStyle: consistent
|
|
75
62
|
Layout/FirstArrayElementLineBreak:
|
|
76
63
|
Enabled: true
|
|
77
|
-
Layout/IndentationWidth:
|
|
78
|
-
Enabled: true
|
|
79
|
-
Layout/ClosingParenthesisIndentation:
|
|
80
|
-
Enabled: true
|
|
81
|
-
Layout/FirstArgumentIndentation:
|
|
82
|
-
Enabled: true
|
|
83
|
-
Layout/ElseAlignment:
|
|
84
|
-
Enabled: true
|
|
85
|
-
Layout/FirstHashElementIndentation:
|
|
86
|
-
Enabled: true
|
|
87
|
-
Layout/AssignmentIndentation:
|
|
88
|
-
Enabled: true
|
|
89
|
-
Layout/CaseIndentation:
|
|
90
|
-
Enabled: true
|
|
91
|
-
Layout/MultilineArrayBraceLayout:
|
|
92
|
-
Enabled: true
|
|
93
|
-
Layout/BeginEndAlignment:
|
|
94
|
-
Enabled: true
|
|
95
|
-
Layout/CommentIndentation:
|
|
96
|
-
Enabled: true
|
|
97
|
-
Layout/DotPosition:
|
|
98
|
-
EnforcedStyle: leading
|
|
99
|
-
Layout/EmptyLineAfterGuardClause:
|
|
100
|
-
Enabled: true
|
|
101
|
-
Layout/IndentationConsistency:
|
|
102
|
-
Enabled: true
|
|
103
64
|
Layout/MultilineMethodParameterLineBreaks:
|
|
104
65
|
Enabled: true
|
|
105
|
-
Layout/SpaceBeforeBlockBraces:
|
|
106
|
-
Enabled: true
|
|
107
|
-
Layout/SpaceInsideBlockBraces:
|
|
108
|
-
Enabled: true
|
|
109
|
-
Layout/SpaceInsideHashLiteralBraces:
|
|
110
|
-
Enabled: true
|
|
111
|
-
Layout/TrailingEmptyLines:
|
|
112
|
-
Enabled: true
|
|
113
|
-
Layout/EmptyLinesAroundClassBody:
|
|
114
|
-
EnforcedStyle: no_empty_lines
|
|
115
|
-
Layout/EmptyLinesAroundBlockBody:
|
|
116
|
-
EnforcedStyle: no_empty_lines
|
|
117
|
-
Layout/TrailingWhitespace:
|
|
118
|
-
AllowInHeredoc: false
|
|
119
|
-
Layout/SpaceBeforeComma:
|
|
120
|
-
Enabled: true
|
|
121
|
-
Layout/SpaceAfterComma:
|
|
122
|
-
Enabled: true
|
|
123
|
-
Layout/EmptyLines:
|
|
124
|
-
Enabled: true
|
|
125
|
-
Layout/EmptyLineAfterMagicComment:
|
|
126
|
-
Enabled: true
|
|
127
66
|
|
|
128
67
|
Lint:
|
|
129
68
|
Enabled: true
|
|
130
69
|
Lint/AmbiguousBlockAssociation:
|
|
131
70
|
Exclude:
|
|
132
71
|
- spec/**/*
|
|
133
|
-
Lint/BinaryOperatorWithIdenticalOperands:
|
|
134
|
-
Enabled: true
|
|
135
|
-
Lint/ConstantDefinitionInBlock:
|
|
136
|
-
Enabled: true
|
|
137
|
-
Lint/DeprecatedOpenSSLConstant:
|
|
138
|
-
Enabled: true
|
|
139
|
-
Lint/DuplicateElsifCondition:
|
|
140
|
-
Enabled: true
|
|
141
|
-
Lint/DuplicateRequire:
|
|
142
|
-
Enabled: true
|
|
143
|
-
Lint/DuplicateRescueException:
|
|
144
|
-
Enabled: true
|
|
145
|
-
Lint/EmptyConditionalBody:
|
|
146
|
-
Enabled: true
|
|
147
|
-
Lint/EmptyFile:
|
|
148
|
-
Enabled: true
|
|
149
|
-
Lint/FloatComparison:
|
|
150
|
-
Enabled: true
|
|
151
|
-
Lint/IdentityComparison:
|
|
152
|
-
Enabled: true
|
|
153
72
|
Lint/Loop:
|
|
154
73
|
Enabled: false
|
|
155
74
|
Lint/MissingSuper:
|
|
156
75
|
Enabled: false
|
|
157
|
-
Lint/MixedRegexpCaptureTypes:
|
|
158
|
-
Enabled: true
|
|
159
|
-
Lint/OutOfRangeRegexpRef:
|
|
160
|
-
Enabled: true
|
|
161
|
-
Lint/RaiseException:
|
|
162
|
-
Enabled: true
|
|
163
|
-
Lint/SelfAssignment:
|
|
164
|
-
Enabled: true
|
|
165
|
-
Lint/StructNewOverride:
|
|
166
|
-
Enabled: true
|
|
167
76
|
Lint/SymbolConversion:
|
|
168
77
|
EnforcedStyle: consistent
|
|
169
|
-
Lint/TopLevelReturnWithArgument:
|
|
170
|
-
Enabled: true
|
|
171
|
-
Lint/TrailingCommaInAttributeDeclaration:
|
|
172
|
-
Enabled: true
|
|
173
|
-
Lint/UnreachableLoop:
|
|
174
|
-
Enabled: true
|
|
175
|
-
Lint/UselessMethodDefinition:
|
|
176
|
-
Enabled: true
|
|
177
|
-
Lint/UselessTimes:
|
|
178
|
-
Enabled: true
|
|
179
|
-
Style/MutableConstant:
|
|
180
|
-
Enabled: true
|
|
181
|
-
Style/StringLiterals:
|
|
182
|
-
Enabled: true
|
|
183
|
-
Style/SymbolArray:
|
|
184
|
-
Enabled: true
|
|
185
78
|
Style/TrailingCommaInHashLiteral:
|
|
186
79
|
Enabled: false
|
|
187
|
-
Style/TrailingCommaInArguments:
|
|
188
|
-
Enabled: true
|
|
189
|
-
Style/WordArray:
|
|
190
|
-
Enabled: true
|
|
191
80
|
Style/HashSyntax:
|
|
192
81
|
Enabled: true
|
|
193
82
|
EnforcedShorthandSyntax: either
|
|
@@ -246,7 +135,7 @@ Lint/IncompatibleIoSelectWithFiberScheduler:
|
|
|
246
135
|
Enabled: false
|
|
247
136
|
Lint/LambdaWithoutLiteralBlock:
|
|
248
137
|
Enabled: false
|
|
249
|
-
Lint/NoReturnInBeginEndBlocks:
|
|
138
|
+
Lint/NoReturnInBeginEndBlocks: # ❌ ENABLE THIS!
|
|
250
139
|
Enabled: false
|
|
251
140
|
Lint/NumberedParameterAssignment:
|
|
252
141
|
Enabled: false
|
|
@@ -513,155 +402,3 @@ Style/EmptyElse:
|
|
|
513
402
|
Enabled: false
|
|
514
403
|
Style/MixinUsage: # Enable and then manually disable offenses?
|
|
515
404
|
Enabled: false
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
# ✅ Enabled in 2.0 version (activated by "enable all rules by default')
|
|
520
|
-
# Let's keep commented list here for visibility for a while
|
|
521
|
-
#
|
|
522
|
-
#Layout/SpaceInsideParens:
|
|
523
|
-
# Enabled: false
|
|
524
|
-
#Layout/SpaceBeforeFirstArg:
|
|
525
|
-
# Enabled: false
|
|
526
|
-
#Layout/ExtraSpacing:
|
|
527
|
-
# Enabled: false
|
|
528
|
-
#Layout/SpaceAfterColon:
|
|
529
|
-
# Enabled: false
|
|
530
|
-
#Rails/PluralizationGrammar:
|
|
531
|
-
# Enabled: false
|
|
532
|
-
#Layout/SpaceAroundMethodCallOperator:
|
|
533
|
-
# Enabled: false
|
|
534
|
-
#Style/RedundantFreeze:
|
|
535
|
-
# Enabled: false
|
|
536
|
-
#Layout/SpaceInLambdaLiteral:
|
|
537
|
-
# Enabled: false
|
|
538
|
-
#Layout/LeadingCommentSpace:
|
|
539
|
-
# Enabled: false
|
|
540
|
-
#Layout/DefEndAlignment:
|
|
541
|
-
# Enabled: false
|
|
542
|
-
#Style/RedundantRegexpEscape:
|
|
543
|
-
# Enabled: false
|
|
544
|
-
#Layout/HeredocIndentation:
|
|
545
|
-
# Enabled: false
|
|
546
|
-
#Layout/ClosingHeredocIndentation:
|
|
547
|
-
# Enabled: false
|
|
548
|
-
#Layout/LeadingEmptyLines:
|
|
549
|
-
# Enabled: false
|
|
550
|
-
#Layout/EmptyLinesAroundAccessModifier:
|
|
551
|
-
# Enabled: false
|
|
552
|
-
#Style/NegatedIf:
|
|
553
|
-
# Enabled: false
|
|
554
|
-
#Style/CommentAnnotation:
|
|
555
|
-
# Enabled: false
|
|
556
|
-
#Layout/MultilineOperationIndentation:
|
|
557
|
-
# Enabled: false
|
|
558
|
-
#Style/ExpandPathArguments:
|
|
559
|
-
# Enabled: false
|
|
560
|
-
#Layout/EmptyLinesAroundMethodBody:
|
|
561
|
-
# Enabled: false
|
|
562
|
-
#Style/RedundantReturn:
|
|
563
|
-
# Enabled: false
|
|
564
|
-
#Style/GlobalStdStream:
|
|
565
|
-
# Enabled: false
|
|
566
|
-
#Style/FloatDivision:
|
|
567
|
-
# Enabled: false
|
|
568
|
-
#Style/RescueStandardError:
|
|
569
|
-
# Enabled: false
|
|
570
|
-
#Style/NilComparison:
|
|
571
|
-
# Enabled: false
|
|
572
|
-
#Style/RedundantFetchBlock:
|
|
573
|
-
# Enabled: false
|
|
574
|
-
#Style/Encoding:
|
|
575
|
-
# Enabled: false
|
|
576
|
-
#Style/EmptyLiteral:
|
|
577
|
-
# Enabled: false
|
|
578
|
-
#Layout/SpaceInsideReferenceBrackets:
|
|
579
|
-
# Enabled: false
|
|
580
|
-
#Style/EmptyLambdaParameter:
|
|
581
|
-
# Enabled: false
|
|
582
|
-
#Style/TernaryParentheses:
|
|
583
|
-
# Enabled: false
|
|
584
|
-
#Naming/MethodName:
|
|
585
|
-
# Enabled: false
|
|
586
|
-
#Style/SlicingWithRange:
|
|
587
|
-
# Enabled: false
|
|
588
|
-
#Style/EmptyCaseCondition:
|
|
589
|
-
# Enabled: false
|
|
590
|
-
#Style/SoleNestedConditional:
|
|
591
|
-
# Enabled: false
|
|
592
|
-
#Rails/FindEach:
|
|
593
|
-
# Enabled: false
|
|
594
|
-
#Style/RedundantFileExtensionInRequire:
|
|
595
|
-
# Enabled: false
|
|
596
|
-
#Layout/SpaceInsideArrayLiteralBrackets:
|
|
597
|
-
# Enabled: false
|
|
598
|
-
#Style/HashAsLastArrayItem:
|
|
599
|
-
# Enabled: false
|
|
600
|
-
#Lint/RedundantCopDisableDirective:
|
|
601
|
-
# Enabled: false
|
|
602
|
-
#Layout/SpaceAroundKeyword:
|
|
603
|
-
# Enabled: false
|
|
604
|
-
#Style/KeywordParametersOrder:
|
|
605
|
-
# Enabled: false
|
|
606
|
-
#Style/BlockComments:
|
|
607
|
-
# Enabled: false
|
|
608
|
-
#Style/AndOr:
|
|
609
|
-
# Enabled: false
|
|
610
|
-
#Style/EachWithObject:
|
|
611
|
-
# Enabled: false
|
|
612
|
-
#Layout/SpaceAroundBlockParameters:
|
|
613
|
-
# Enabled: false
|
|
614
|
-
#Style/MultilineTernaryOperator:
|
|
615
|
-
# Enabled: false
|
|
616
|
-
#Style/RedundantParentheses:
|
|
617
|
-
# Enabled: false
|
|
618
|
-
#Security/JSONLoad:
|
|
619
|
-
# Enabled: false
|
|
620
|
-
#Style/MethodCallWithoutArgsParentheses:
|
|
621
|
-
# Enabled: false
|
|
622
|
-
#Style/CommentedKeyword:
|
|
623
|
-
# Enabled: false
|
|
624
|
-
#Style/MultilineIfModifier:
|
|
625
|
-
# Enabled: false
|
|
626
|
-
#Style/IfInsideElse:
|
|
627
|
-
# Enabled: false
|
|
628
|
-
#Style/AccessorGrouping:
|
|
629
|
-
# Enabled: false
|
|
630
|
-
#Layout/BlockEndNewline:
|
|
631
|
-
# Enabled: false
|
|
632
|
-
#Rails/RedundantForeignKey:
|
|
633
|
-
# Enabled: false
|
|
634
|
-
#Style/UnlessElse:
|
|
635
|
-
# Enabled: false
|
|
636
|
-
#Layout/EmptyLinesAroundModuleBody:
|
|
637
|
-
# Enabled: false
|
|
638
|
-
#Rails/RakeEnvironment:
|
|
639
|
-
# Enabled: false
|
|
640
|
-
#Layout/EmptyLinesAroundArguments:
|
|
641
|
-
# Enabled: false
|
|
642
|
-
#Style/EachForSimpleLoop:
|
|
643
|
-
# Enabled: false
|
|
644
|
-
#Style/ClassCheck:
|
|
645
|
-
# Enabled: false
|
|
646
|
-
#Style/NestedParenthesizedCalls:
|
|
647
|
-
# Enabled: false
|
|
648
|
-
#Style/LineEndConcatenation:
|
|
649
|
-
# Enabled: false
|
|
650
|
-
#Style/ParallelAssignment:
|
|
651
|
-
# Enabled: false
|
|
652
|
-
#Layout/EmptyLinesAroundExceptionHandlingKeywords:
|
|
653
|
-
# Enabled: false
|
|
654
|
-
#Layout/SpaceAroundEqualsInParameterDefault:
|
|
655
|
-
# Enabled: false
|
|
656
|
-
#Style/YodaCondition:
|
|
657
|
-
# Enabled: false
|
|
658
|
-
#Layout/SpaceInsideStringInterpolation:
|
|
659
|
-
# Enabled: false
|
|
660
|
-
#Style/EmptyMethod:
|
|
661
|
-
# Enabled: false
|
|
662
|
-
#Layout/EmptyLineBetweenDefs:
|
|
663
|
-
# Enabled: false
|
|
664
|
-
#Naming/ConstantName:
|
|
665
|
-
# Enabled: false
|
|
666
|
-
#Rails/RelativeDateConstant:
|
|
667
|
-
# Enabled: false
|
data/lib/nxt_cop/version.rb
CHANGED
data/nxt_cop.gemspec
CHANGED
|
@@ -38,4 +38,6 @@ Gem::Specification.new do |spec|
|
|
|
38
38
|
spec.add_dependency 'rubocop-rspec', '~> 2.12'
|
|
39
39
|
spec.add_development_dependency 'bundler', '~> 2.1'
|
|
40
40
|
spec.add_development_dependency 'rake', '~> 13.0'
|
|
41
|
+
spec.add_development_dependency 'rspec'
|
|
42
|
+
spec.add_development_dependency 'rspec_junit_formatter'
|
|
41
43
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nxt_cop
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Scott Livingstone
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-02-
|
|
11
|
+
date: 2024-02-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rubocop
|
|
@@ -80,13 +80,43 @@ dependencies:
|
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: '13.0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rspec
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rspec_junit_formatter
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
83
111
|
description:
|
|
84
112
|
email:
|
|
85
113
|
executables: []
|
|
86
114
|
extensions: []
|
|
87
115
|
extra_rdoc_files: []
|
|
88
116
|
files:
|
|
117
|
+
- ".circleci/config.yml"
|
|
89
118
|
- ".gitignore"
|
|
119
|
+
- ".rspec"
|
|
90
120
|
- ".rubocop.yml"
|
|
91
121
|
- ".ruby-version"
|
|
92
122
|
- ".tool-versions"
|
|
@@ -100,7 +130,6 @@ files:
|
|
|
100
130
|
- bin/guard
|
|
101
131
|
- bin/rspec
|
|
102
132
|
- bin/setup
|
|
103
|
-
- custom_cops/nxt_core/rails/missing_logger_include.rb
|
|
104
133
|
- custom_cops/nxt_core/rails/use_of_rails_logger.rb
|
|
105
134
|
- default.yml
|
|
106
135
|
- lib/nxt_cop/version.rb
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module CustomCops
|
|
4
|
-
module NxtCore
|
|
5
|
-
module Rails
|
|
6
|
-
# The NxtCore logger requires an include in most cases. Ensures it is present.
|
|
7
|
-
#
|
|
8
|
-
# @safety
|
|
9
|
-
# This cop's autocorrection is unsafe because
|
|
10
|
-
# `logger` may refer to an instance variable or other method of the class.
|
|
11
|
-
class MissingLoggerInclude < RuboCop::Cop::Base
|
|
12
|
-
extend RuboCop::Cop::AutoCorrector
|
|
13
|
-
|
|
14
|
-
RESTRICT_ON_SEND = [:logger].freeze
|
|
15
|
-
|
|
16
|
-
MSG = 'Missing `include Nxt::Loggable` for a class which uses the logger.'
|
|
17
|
-
|
|
18
|
-
# NodePattern docs: https://github.com/rubocop/rubocop-ast/blob/master/docs/modules/ROOT/pages/node_pattern.adoc
|
|
19
|
-
def_node_matcher :includes_nxt_loggable?, <<~PATTERN
|
|
20
|
-
(begin <(send nil? :include (const (const nil? :Nxt) :Loggable)) ...>)
|
|
21
|
-
PATTERN
|
|
22
|
-
|
|
23
|
-
def on_send(node)
|
|
24
|
-
return unless node.receiver.nil?
|
|
25
|
-
|
|
26
|
-
class_node = node.ancestors.find(&:class_type?)
|
|
27
|
-
return unless class_node
|
|
28
|
-
|
|
29
|
-
class_definition_node = class_node.each_child_node(:begin).first
|
|
30
|
-
return if includes_nxt_loggable?(class_definition_node)
|
|
31
|
-
|
|
32
|
-
add_offense(class_node, message: MSG) do |corrector|
|
|
33
|
-
corrector.insert_before(class_definition_node.child_nodes.first, "include Nxt::Loggable\n")
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|