kuyio-rubocop 0.1.5 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -1
- data/Gemfile +2 -0
- data/Rakefile +2 -0
- data/kuyio-rubocop.gemspec +12 -8
- data/lib/kuyio/rubocop/version.rb +1 -1
- data/lib/kuyio/rubocop.rb +2 -0
- data/rubocop-all.yml +14 -0
- data/rubocop-bundler.yml +4 -0
- data/rubocop-default.yml +19 -0
- data/rubocop-gemspec.yml +12 -0
- data/rubocop-layout.yml +306 -0
- data/rubocop-lint.yml +397 -0
- data/rubocop-metrics.yml +44 -0
- data/rubocop-naming.yml +65 -0
- data/rubocop-performance.yml +146 -0
- data/rubocop-rails.yml +195 -0
- data/rubocop-rspec.yml +160 -0
- data/rubocop-security.yml +18 -0
- data/rubocop-style.yml +464 -0
- metadata +41 -15
- data/default.yml +0 -175
data/rubocop-rails.yml
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
---
|
2
|
+
require:
|
3
|
+
- rubocop-rails
|
4
|
+
|
5
|
+
# Enables Rails cops.
|
6
|
+
Rails:
|
7
|
+
Enabled: true
|
8
|
+
|
9
|
+
# Enforces consistent use of action filter methods.
|
10
|
+
Rails/ActionFilter:
|
11
|
+
Enabled: true
|
12
|
+
EnforcedStyle: action
|
13
|
+
|
14
|
+
# Checks that Active Record callbacks are declared in the order in which they will be executed.
|
15
|
+
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsactiverecordcallbacksorder
|
16
|
+
Rails/ActiveRecordCallbacksOrder:
|
17
|
+
Enabled: true
|
18
|
+
|
19
|
+
# Enforces that there is only one call to after_commit
|
20
|
+
# (and its aliases - after_create_commit, after_update_commit, and after_destroy_commit)
|
21
|
+
# with the same callback name per model.
|
22
|
+
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsaftercommitoverride
|
23
|
+
Rails/AfterCommitOverride:
|
24
|
+
Enabled: true
|
25
|
+
|
26
|
+
# Check that models subclass ApplicationRecord.
|
27
|
+
Rails/ApplicationRecord:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Rails/AttributeDefaultBlockValue: # (new in 2.9)
|
31
|
+
Enabled: true
|
32
|
+
|
33
|
+
# Enforce using `blank?` and `present?`.
|
34
|
+
Rails/Blank:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
# Checks the correct usage of date aware methods, such as `Date.today`,
|
38
|
+
# `Date.current`, etc.
|
39
|
+
Rails/Date:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
# Prefer delegate method for delegations.
|
43
|
+
# Disabled per https://gitlab.com/gitlab-org/gitlab-ce/issues/35869
|
44
|
+
Rails/Delegate:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
# This cop checks dynamic `find_by_*` methods.
|
48
|
+
Rails/DynamicFindBy:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
# This cop enforces that 'exit' calls are not used within a rails app.
|
52
|
+
Rails/Exit:
|
53
|
+
Enabled: true
|
54
|
+
Exclude:
|
55
|
+
- lib/gitlab/upgrader.rb
|
56
|
+
- 'lib/backup/**/*'
|
57
|
+
|
58
|
+
# Prefer `find_by` over `where.first`.
|
59
|
+
Rails/FindBy:
|
60
|
+
Enabled: true
|
61
|
+
Include:
|
62
|
+
- 'app/**/*.rb'
|
63
|
+
- 'lib/**/*.rb'
|
64
|
+
|
65
|
+
# Enforces that ActiveRecord#find is used instead of where.take!, find_by!, and find_by_id!
|
66
|
+
# to retrieve a single record by primary key when you expect it to be found.
|
67
|
+
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsfindbyid
|
68
|
+
Rails/FindById:
|
69
|
+
Enabled: true
|
70
|
+
|
71
|
+
# Prefer `all.find_each` over `all.find`.
|
72
|
+
Rails/FindEach:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
# Prefer has_many :through to has_and_belongs_to_many.
|
76
|
+
Rails/HasAndBelongsToMany:
|
77
|
+
Enabled: true
|
78
|
+
|
79
|
+
# This cop is used to identify usages of http methods like `get`, `post`,
|
80
|
+
# `put`, `patch` without the usage of keyword arguments in your tests and
|
81
|
+
# change them to use keyword args.
|
82
|
+
Rails/HttpPositionalArguments:
|
83
|
+
Enabled: true
|
84
|
+
|
85
|
+
# Checks that Active Support’s inquiry method is not used.
|
86
|
+
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsinquiry
|
87
|
+
Rails/Inquiry:
|
88
|
+
Enabled: true
|
89
|
+
|
90
|
+
# Enforces that mailer names end with Mailer suffix.
|
91
|
+
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsmailername
|
92
|
+
Rails/MailerName:
|
93
|
+
Enabled: true
|
94
|
+
|
95
|
+
# Identifies places where defining routes with match can be replaced with a specific HTTP method.
|
96
|
+
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsmatchroute
|
97
|
+
Rails/MatchRoute:
|
98
|
+
Enabled: true
|
99
|
+
|
100
|
+
# Enforces the use of collection.exclude?(obj) over !collection.include?(obj).
|
101
|
+
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsnegateinclude
|
102
|
+
Rails/NegateInclude:
|
103
|
+
Enabled: true
|
104
|
+
|
105
|
+
# Checks for calls to puts, print, etc.
|
106
|
+
Rails/Output:
|
107
|
+
Enabled: true
|
108
|
+
Exclude:
|
109
|
+
- lib/gitlab/seeder.rb
|
110
|
+
- lib/gitlab/upgrader.rb
|
111
|
+
- 'lib/backup/**/*'
|
112
|
+
- 'lib/tasks/**/*'
|
113
|
+
|
114
|
+
# This cop checks for the use of output safety calls like html_safe and
|
115
|
+
# raw.
|
116
|
+
Rails/OutputSafety:
|
117
|
+
Enabled: true
|
118
|
+
|
119
|
+
# Enforces the use of pluck over map.
|
120
|
+
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railspluck
|
121
|
+
Rails/Pluck:
|
122
|
+
Enabled: true
|
123
|
+
|
124
|
+
# Identifies places where pluck is used in where query methods and can be replaced with select.
|
125
|
+
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railspluckinwhere
|
126
|
+
Rails/PluckInWhere:
|
127
|
+
Enabled: true
|
128
|
+
|
129
|
+
# Checks for incorrect grammar when using methods like `3.day.ago`.
|
130
|
+
Rails/PluralizationGrammar:
|
131
|
+
Enabled: true
|
132
|
+
|
133
|
+
# Enforce using `blank?` and `present?`.
|
134
|
+
Rails/Present:
|
135
|
+
Enabled: false
|
136
|
+
|
137
|
+
# Checks for `read_attribute(:attr)` and `write_attribute(:attr, val)`.
|
138
|
+
Rails/ReadWriteAttribute:
|
139
|
+
Enabled: false
|
140
|
+
|
141
|
+
# Do not assign relative date to constants.
|
142
|
+
Rails/RelativeDateConstant:
|
143
|
+
Enabled: false
|
144
|
+
|
145
|
+
# Looks for inline rendering within controller actions.
|
146
|
+
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsrenderinline
|
147
|
+
Rails/RenderInline:
|
148
|
+
Enabled: true
|
149
|
+
|
150
|
+
# Identifies places where render text: can be replaced with render plain:.
|
151
|
+
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsrenderplaintext
|
152
|
+
Rails/RenderPlainText:
|
153
|
+
Enabled: true
|
154
|
+
|
155
|
+
# Checks the arguments of ActiveRecord scopes.
|
156
|
+
Rails/ScopeArgs:
|
157
|
+
Enabled: true
|
158
|
+
|
159
|
+
# Enforces that short forms of I18n methods are used: t instead of translate and l instead of localize.
|
160
|
+
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsshorti18n
|
161
|
+
Rails/ShortI18n:
|
162
|
+
Enabled: true
|
163
|
+
|
164
|
+
# Checks SQL heredocs to use .squish.
|
165
|
+
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railssquishedsqlheredocs
|
166
|
+
Rails/SquishedSQLHeredocs:
|
167
|
+
Enabled: true
|
168
|
+
|
169
|
+
# This cop checks for the use of Time methods without zone.
|
170
|
+
Rails/TimeZone:
|
171
|
+
Enabled: false
|
172
|
+
|
173
|
+
# Checks for the use of exit statements (namely return, break and throw) in
|
174
|
+
# transactions. This is due to the eventual unexpected behavior when using
|
175
|
+
# ActiveRecord >= 7, where transactions exited using these statements are being
|
176
|
+
# rollbacked rather than committed (pre ActiveRecord 7 behavior).
|
177
|
+
Rails/TransactionExitStatement:
|
178
|
+
Enabled: true
|
179
|
+
|
180
|
+
# This cop checks for the use of old-style attribute validation macros.
|
181
|
+
Rails/Validation:
|
182
|
+
Enabled: true
|
183
|
+
|
184
|
+
Rails/WhereEquals: # (new in 2.9)
|
185
|
+
Enabled: true
|
186
|
+
|
187
|
+
# Enforces consistent style when using exists?.
|
188
|
+
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railswhereexists
|
189
|
+
Rails/WhereExists:
|
190
|
+
Enabled: true
|
191
|
+
|
192
|
+
# Identifies places where manually constructed SQL in where can be replaced with where.not(...).
|
193
|
+
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railswherenot
|
194
|
+
Rails/WhereNot:
|
195
|
+
Enabled: true
|
data/rubocop-rspec.yml
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
---
|
2
|
+
require:
|
3
|
+
- rubocop-rspec
|
4
|
+
|
5
|
+
# Check that instances are not being stubbed globally.
|
6
|
+
RSpec/AnyInstance:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
# Check for expectations where `be(...)` can replace `eql(...)`.
|
10
|
+
RSpec/BeEql:
|
11
|
+
Enabled: true
|
12
|
+
|
13
|
+
# We don't enforce this as we use this technique in a few places.
|
14
|
+
RSpec/BeforeAfterAll:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
# Enforces consistent use of be_a or be_kind_of.
|
18
|
+
# https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/merge_requests/131#note_1141022718
|
19
|
+
RSpec/ClassCheck:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
# Check that the first argument to the top level describe is the tested class or
|
23
|
+
# module.
|
24
|
+
RSpec/DescribeClass:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
# Checks that the second argument to `describe` specifies a method.
|
28
|
+
RSpec/DescribeMethod:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
# Avoid describing symbols.
|
32
|
+
RSpec/DescribeSymbol:
|
33
|
+
Enabled: true
|
34
|
+
|
35
|
+
# Checks that tests use `described_class`.
|
36
|
+
RSpec/DescribedClass:
|
37
|
+
Enabled: true
|
38
|
+
SkipBlocks: true
|
39
|
+
|
40
|
+
# Checks if an example group does not include any tests.
|
41
|
+
RSpec/EmptyExampleGroup:
|
42
|
+
Enabled: true
|
43
|
+
|
44
|
+
# Checks for long example.
|
45
|
+
RSpec/ExampleLength:
|
46
|
+
Enabled: false
|
47
|
+
Max: 5
|
48
|
+
|
49
|
+
# Do not use should when describing your tests.
|
50
|
+
RSpec/ExampleWording:
|
51
|
+
Enabled: true
|
52
|
+
CustomTransform:
|
53
|
+
be: is
|
54
|
+
have: has
|
55
|
+
not: does not
|
56
|
+
IgnoredWords: []
|
57
|
+
|
58
|
+
# Checks for `expect(...)` calls containing literal values.
|
59
|
+
RSpec/ExpectActual:
|
60
|
+
Enabled: true
|
61
|
+
|
62
|
+
# Checks for `expect {...}.to change {...}` using a block.
|
63
|
+
# See https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/merge_requests/122#note_1089192391
|
64
|
+
RSpec/ExpectChange:
|
65
|
+
Enabled: true
|
66
|
+
EnforcedStyle: block
|
67
|
+
|
68
|
+
# Checks for opportunities to use `expect { … }.to output`.
|
69
|
+
RSpec/ExpectOutput:
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
# Checks the file and folder naming of the spec file.
|
73
|
+
RSpec/FilePath:
|
74
|
+
Enabled: true
|
75
|
+
IgnoreMethods: true
|
76
|
+
|
77
|
+
# Checks if there are focused specs.
|
78
|
+
RSpec/Focus:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
# Checks the arguments passed to `before`, `around`, and `after`.
|
82
|
+
RSpec/HookArgument:
|
83
|
+
Enabled: true
|
84
|
+
EnforcedStyle: implicit
|
85
|
+
|
86
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
87
|
+
# SupportedStyles: is_expected, should
|
88
|
+
RSpec/ImplicitExpect:
|
89
|
+
Enabled: true
|
90
|
+
EnforcedStyle: is_expected
|
91
|
+
|
92
|
+
# Checks for the usage of instance variables.
|
93
|
+
# https://docs.gitlab.com/ee/development/testing_guide/best_practices.html#subject-and-let-variables
|
94
|
+
RSpec/InstanceVariable:
|
95
|
+
Enabled: true
|
96
|
+
|
97
|
+
# Checks for `subject` definitions that come after `let` definitions.
|
98
|
+
RSpec/LeadingSubject:
|
99
|
+
Enabled: false
|
100
|
+
|
101
|
+
# Checks unreferenced `let!` calls being used for test setup.
|
102
|
+
RSpec/LetSetup:
|
103
|
+
Enabled: false
|
104
|
+
|
105
|
+
# Check that chains of messages are not being stubbed.
|
106
|
+
RSpec/MessageChain:
|
107
|
+
Enabled: false
|
108
|
+
|
109
|
+
# Checks that message expectations are set using spies.
|
110
|
+
RSpec/MessageSpies:
|
111
|
+
Enabled: false
|
112
|
+
|
113
|
+
# Checks for multiple top-level describes.
|
114
|
+
RSpec/MultipleDescribes:
|
115
|
+
Enabled: false
|
116
|
+
|
117
|
+
# Checks if examples contain too many `expect` calls.
|
118
|
+
RSpec/MultipleExpectations:
|
119
|
+
Enabled: false
|
120
|
+
|
121
|
+
# Checks for explicitly referenced test subjects.
|
122
|
+
RSpec/NamedSubject:
|
123
|
+
Enabled: true
|
124
|
+
|
125
|
+
# Checks for nested example groups.
|
126
|
+
RSpec/NestedGroups:
|
127
|
+
Enabled: false
|
128
|
+
|
129
|
+
# Enforces the usage of the same method on all negative message expectations.
|
130
|
+
RSpec/NotToNot:
|
131
|
+
EnforcedStyle: not_to
|
132
|
+
Enabled: true
|
133
|
+
|
134
|
+
# See https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/merge_requests/122#note_1089202045
|
135
|
+
RSpec/PredicateMatcher:
|
136
|
+
Enabled: false
|
137
|
+
|
138
|
+
# Check for repeated description strings in example groups.
|
139
|
+
RSpec/RepeatedDescription:
|
140
|
+
Enabled: false
|
141
|
+
|
142
|
+
# Checks that message expectations do not have a configured response.
|
143
|
+
# https://docs.rubocop.org/rubocop-rspec/1.44/cops_rspec.html#rspecstubbedmock
|
144
|
+
RSpec/StubbedMock:
|
145
|
+
Enabled: false
|
146
|
+
|
147
|
+
# Checks for stubbed test subjects.
|
148
|
+
RSpec/SubjectStub:
|
149
|
+
Enabled: false
|
150
|
+
|
151
|
+
# Prefer using verifying doubles over normal doubles.
|
152
|
+
RSpec/VerifiedDoubles:
|
153
|
+
Enabled: true
|
154
|
+
|
155
|
+
RSpec:
|
156
|
+
Language:
|
157
|
+
Helpers:
|
158
|
+
- let_it_be
|
159
|
+
- let_it_be_with_refind
|
160
|
+
- let_it_be_with_reload
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
# Checks for implementations of the hash method which combine values using
|
3
|
+
# custom logic instead of delegating to Array#hash.
|
4
|
+
Security/CompoundHash:
|
5
|
+
Enabled: true
|
6
|
+
|
7
|
+
# This cop checks for the use of JSON class methods which have potential
|
8
|
+
# security issues.
|
9
|
+
Security/JSONLoad:
|
10
|
+
Enabled: true
|
11
|
+
|
12
|
+
# This cop checks for the use of *Kernel#eval*.
|
13
|
+
Security/Eval:
|
14
|
+
Enabled: true
|
15
|
+
|
16
|
+
# Checks for the first argument to IO.read, IO.binread, IO.write, IO.binwrite, IO.foreach, and IO.readlines
|
17
|
+
Security/IoMethods:
|
18
|
+
Enabled: true
|