standard-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ab3080f565a9c7d7580405c2007ab6c06d1bea30f1e7dffd505d0ef9c0c390e6
4
+ data.tar.gz: 77d4a5d0a5b645f86d3a13aa492eb2c7319989f515b25f06c125b689abff434b
5
+ SHA512:
6
+ metadata.gz: fafc62eb0a95ff6eeb6c170218ac4297ccdba6187a6a741058fc777802542ca463f211faa44a6ccb8e019edecc117278799c1d87dcf3603a6a553102e6915a70
7
+ data.tar.gz: e1ffb63b3a0d5419e975a63f6b2992e0211ba2e1bafc4b2f272b2ea9a64d0d3052495e83b22cc8c5bdaebec79fd41c67ac01cd38ff31b76cb771811dd8e2792f
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/testdouble/standard
3
+ ruby_version: 2.6
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## 0.0.1
2
+
3
+ - Initial release. Doesn't actually exist as a plugin yet, but can be imported
4
+ via `extend_config`. We don't recommend this, however, as all the values are
5
+ currently set to rubocop-rails defaults!
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in standard-rails.gemspec
4
+ gemspec
5
+
6
+ gem "rake"
7
+ gem "minitest"
8
+ gem "standard"
data/Gemfile.lock ADDED
@@ -0,0 +1,68 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ standard-rails (0.0.1)
5
+ rubocop-rails (~> 2.18.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (7.0.4.3)
11
+ concurrent-ruby (~> 1.0, >= 1.0.2)
12
+ i18n (>= 1.6, < 2)
13
+ minitest (>= 5.1)
14
+ tzinfo (~> 2.0)
15
+ ast (2.4.2)
16
+ concurrent-ruby (1.2.2)
17
+ i18n (1.12.0)
18
+ concurrent-ruby (~> 1.0)
19
+ json (2.6.3)
20
+ language_server-protocol (3.17.0.3)
21
+ minitest (5.18.0)
22
+ parallel (1.22.1)
23
+ parser (3.2.1.1)
24
+ ast (~> 2.4.1)
25
+ rack (3.0.7)
26
+ rainbow (3.1.1)
27
+ rake (13.0.6)
28
+ regexp_parser (2.7.0)
29
+ rexml (3.2.5)
30
+ rubocop (1.48.1)
31
+ json (~> 2.3)
32
+ parallel (~> 1.10)
33
+ parser (>= 3.2.0.0)
34
+ rainbow (>= 2.2.2, < 4.0)
35
+ regexp_parser (>= 1.8, < 3.0)
36
+ rexml (>= 3.2.5, < 4.0)
37
+ rubocop-ast (>= 1.26.0, < 2.0)
38
+ ruby-progressbar (~> 1.7)
39
+ unicode-display_width (>= 2.4.0, < 3.0)
40
+ rubocop-ast (1.27.0)
41
+ parser (>= 3.2.1.0)
42
+ rubocop-performance (1.16.0)
43
+ rubocop (>= 1.7.0, < 2.0)
44
+ rubocop-ast (>= 0.4.0)
45
+ rubocop-rails (2.18.0)
46
+ activesupport (>= 4.2.0)
47
+ rack (>= 1.1)
48
+ rubocop (>= 1.33.0, < 2.0)
49
+ ruby-progressbar (1.13.0)
50
+ standard (1.25.2)
51
+ language_server-protocol (~> 3.17.0.2)
52
+ rubocop (= 1.48.1)
53
+ rubocop-performance (= 1.16.0)
54
+ tzinfo (2.0.6)
55
+ concurrent-ruby (~> 1.0)
56
+ unicode-display_width (2.4.2)
57
+
58
+ PLATFORMS
59
+ arm64-darwin-22
60
+
61
+ DEPENDENCIES
62
+ minitest
63
+ rake
64
+ standard
65
+ standard-rails!
66
+
67
+ BUNDLED WITH
68
+ 2.4.8
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Test Double, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # standard-rails
2
+
3
+ This gem will be the first official plugin for the
4
+ [standard](https://github.com/testdouble/standard) gem, which is a Ruby code
5
+ linter and formatter.
6
+
7
+ ## Code of Conduct
8
+
9
+ This project follows Test Double's [code of
10
+ conduct](https://testdouble.com/code-of-conduct) for all community interactions,
11
+ including (but not limited to) one-on-one communications, public posts/comments,
12
+ code reviews, pull requests, and GitHub issues. If violations occur, Test Double
13
+ will take any action they deem appropriate for the infraction, up to and
14
+ including blocking a user from the organization's repositories.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ require "standard/rake"
11
+
12
+ task default: %i[test standard:fix]
data/config/base.yml ADDED
@@ -0,0 +1,758 @@
1
+ # Common configuration.
2
+
3
+ inherit_mode:
4
+ merge:
5
+ - Exclude
6
+
7
+ AllCops:
8
+ Exclude:
9
+ - bin/*
10
+ - db/schema.rb
11
+ # What version of Rails is the inspected code using? If a value is specified
12
+ # for TargetRailsVersion then it is used. Acceptable values are specificed
13
+ # as a float (i.e. 5.1); the patch version of Rails should not be included.
14
+ # If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
15
+ # gems.locked file to find the version of Rails that has been bound to the
16
+ # application. If neither of those files exist, RuboCop will use Rails 5.0
17
+ # as the default.
18
+ TargetRailsVersion: ~
19
+
20
+ Rails/ActionFilter:
21
+ Description: 'Enforces consistent use of action filter methods.'
22
+ Enabled: true
23
+ VersionAdded: '0.19'
24
+ EnforcedStyle: action
25
+ SupportedStyles:
26
+ - action
27
+ - filter
28
+ Include:
29
+ - app/controllers/**/*.rb
30
+
31
+ Rails/ActiveRecordAliases:
32
+ Description: >-
33
+ Avoid Active Record aliases:
34
+ Use `update` instead of `update_attributes`.
35
+ Use `update!` instead of `update_attributes!`.
36
+ Enabled: true
37
+ VersionAdded: '0.53'
38
+ SafeAutoCorrect: false
39
+
40
+ Rails/ActiveRecordCallbacksOrder:
41
+ Description: 'Order callback declarations in the order in which they will be executed.'
42
+ StyleGuide: 'https://rails.rubystyle.guide/#callbacks-order'
43
+ Enabled: 'pending'
44
+ VersionAdded: '2.7'
45
+ Include:
46
+ - app/models/**/*.rb
47
+
48
+ Rails/ActiveRecordOverride:
49
+ Description: >-
50
+ Check for overriding Active Record methods instead of using
51
+ callbacks.
52
+ Enabled: true
53
+ VersionAdded: '0.67'
54
+ Include:
55
+ - app/models/**/*.rb
56
+
57
+ Rails/ActiveSupportAliases:
58
+ Description: >-
59
+ Avoid ActiveSupport aliases of standard ruby methods:
60
+ `String#starts_with?`, `String#ends_with?`,
61
+ `Array#append`, `Array#prepend`.
62
+ Enabled: true
63
+ VersionAdded: '0.48'
64
+
65
+ Rails/AfterCommitOverride:
66
+ Description: >-
67
+ This cop enforces that there is only one call to `after_commit`
68
+ (and its aliases - `after_create_commit`, `after_update_commit`,
69
+ and `after_destroy_commit`) with the same callback name per model.
70
+ Enabled: 'pending'
71
+ VersionAdded: '2.8'
72
+
73
+ Rails/ApplicationController:
74
+ Description: 'Check that controllers subclass ApplicationController.'
75
+ Enabled: true
76
+ SafeAutoCorrect: false
77
+ VersionAdded: '2.4'
78
+ VersionChanged: '2.5'
79
+
80
+ Rails/ApplicationJob:
81
+ Description: 'Check that jobs subclass ApplicationJob.'
82
+ Enabled: true
83
+ SafeAutoCorrect: false
84
+ VersionAdded: '0.49'
85
+ VersionChanged: '2.5'
86
+
87
+ Rails/ApplicationMailer:
88
+ Description: 'Check that mailers subclass ApplicationMailer.'
89
+ Enabled: true
90
+ SafeAutoCorrect: false
91
+ VersionAdded: '2.4'
92
+ VersionChanged: '2.5'
93
+
94
+ Rails/ApplicationRecord:
95
+ Description: 'Check that models subclass ApplicationRecord.'
96
+ Enabled: true
97
+ SafeAutoCorrect: false
98
+ VersionAdded: '0.49'
99
+ VersionChanged: '2.5'
100
+
101
+ Rails/ArelStar:
102
+ Description: 'Enforces `Arel.star` instead of `"*"` for expanded columns.'
103
+ Enabled: true
104
+ SafeAutoCorrect: false
105
+ VersionAdded: '2.9'
106
+
107
+ Rails/AssertNot:
108
+ Description: 'Use `assert_not` instead of `assert !`.'
109
+ Enabled: true
110
+ VersionAdded: '0.56'
111
+ Include:
112
+ - '**/test/**/*'
113
+
114
+ Rails/AttributeDefaultBlockValue:
115
+ Description: 'Pass method call in block for attribute option `default`.'
116
+ Enabled: pending
117
+ VersionAdded: '2.9'
118
+ Include:
119
+ - 'models/**/*'
120
+
121
+ Rails/BelongsTo:
122
+ Description: >-
123
+ Use `optional: true` instead of `required: false` for
124
+ `belongs_to` relations.
125
+ Enabled: true
126
+ VersionAdded: '0.62'
127
+
128
+ Rails/Blank:
129
+ Description: 'Enforces use of `blank?`.'
130
+ Enabled: true
131
+ VersionAdded: '0.48'
132
+ VersionChanged: '0.67'
133
+ # Convert usages of `nil? || empty?` to `blank?`
134
+ NilOrEmpty: true
135
+ # Convert usages of `!present?` to `blank?`
136
+ NotPresent: true
137
+ # Convert usages of `unless present?` to `if blank?`
138
+ UnlessPresent: true
139
+
140
+ Rails/BulkChangeTable:
141
+ Description: 'Check whether alter queries are combinable.'
142
+ Enabled: true
143
+ VersionAdded: '0.57'
144
+ Database: null
145
+ SupportedDatabases:
146
+ - mysql
147
+ - postgresql
148
+ Include:
149
+ - db/migrate/*.rb
150
+
151
+ Rails/ContentTag:
152
+ Description: 'Use `tag` instead of `content_tag`.'
153
+ Reference:
154
+ - 'https://github.com/rails/rails/issues/25195'
155
+ - 'https://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag'
156
+ Enabled: true
157
+ VersionAdded: '2.6'
158
+
159
+ Rails/CreateTableWithTimestamps:
160
+ Description: >-
161
+ Checks the migration for which timestamps are not included
162
+ when creating a new table.
163
+ Enabled: true
164
+ VersionAdded: '0.52'
165
+ Include:
166
+ - db/migrate/*.rb
167
+
168
+ Rails/Date:
169
+ Description: >-
170
+ Checks the correct usage of date aware methods,
171
+ such as Date.today, Date.current etc.
172
+ Enabled: true
173
+ VersionAdded: '0.30'
174
+ VersionChanged: '0.33'
175
+ # The value `strict` disallows usage of `Date.today`, `Date.current`,
176
+ # `Date#to_time` etc.
177
+ # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
178
+ # (but not `Date.today`) which are overridden by ActiveSupport to handle current
179
+ # time zone.
180
+ EnforcedStyle: flexible
181
+ SupportedStyles:
182
+ - strict
183
+ - flexible
184
+
185
+ Rails/DefaultScope:
186
+ Description: 'Avoid use of `default_scope`.'
187
+ StyleGuide: 'https://rails.rubystyle.guide#avoid-default-scope'
188
+ Enabled: false
189
+ VersionAdded: '2.7'
190
+
191
+ Rails/Delegate:
192
+ Description: 'Prefer delegate method for delegations.'
193
+ Enabled: true
194
+ VersionAdded: '0.21'
195
+ VersionChanged: '0.50'
196
+ # When set to true, using the target object as a prefix of the
197
+ # method name without using the `delegate` method will be a
198
+ # violation. When set to false, this case is legal.
199
+ EnforceForPrefixed: true
200
+
201
+ Rails/DelegateAllowBlank:
202
+ Description: 'Do not use allow_blank as an option to delegate.'
203
+ Enabled: true
204
+ VersionAdded: '0.44'
205
+
206
+ Rails/DynamicFindBy:
207
+ Description: 'Use `find_by` instead of dynamic `find_by_*`.'
208
+ StyleGuide: 'https://rails.rubystyle.guide#find_by'
209
+ Enabled: true
210
+ VersionAdded: '0.44'
211
+ VersionChanged: '2.6'
212
+ # The `Whitelist` has been deprecated, Please use `AllowedMethods` instead.
213
+ Whitelist:
214
+ - find_by_sql
215
+ AllowedMethods:
216
+ - find_by_sql
217
+ AllowedReceivers:
218
+ - Gem::Specification
219
+
220
+ Rails/EnumHash:
221
+ Description: 'Prefer hash syntax over array syntax when defining enums.'
222
+ StyleGuide: 'https://rails.rubystyle.guide#enums'
223
+ Enabled: true
224
+ VersionAdded: '2.3'
225
+ Include:
226
+ - app/models/**/*.rb
227
+
228
+ Rails/EnumUniqueness:
229
+ Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
230
+ Enabled: true
231
+ VersionAdded: '0.46'
232
+ Include:
233
+ - app/models/**/*.rb
234
+
235
+ Rails/EnvironmentComparison:
236
+ Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`."
237
+ Enabled: true
238
+ VersionAdded: '0.52'
239
+
240
+ Rails/Exit:
241
+ Description: >-
242
+ Favor `fail`, `break`, `return`, etc. over `exit` in
243
+ application or library code outside of Rake files to avoid
244
+ exits during unit testing or running in production.
245
+ Enabled: true
246
+ VersionAdded: '0.41'
247
+ Include:
248
+ - app/**/*.rb
249
+ - config/**/*.rb
250
+ - lib/**/*.rb
251
+ Exclude:
252
+ - lib/**/*.rake
253
+
254
+ Rails/FilePath:
255
+ Description: 'Use `Rails.root.join` for file path joining.'
256
+ Enabled: true
257
+ VersionAdded: '0.47'
258
+ VersionChanged: '2.4'
259
+ EnforcedStyle: slashes
260
+ SupportedStyles:
261
+ - slashes
262
+ - arguments
263
+
264
+ Rails/FindBy:
265
+ Description: 'Prefer find_by over where.first.'
266
+ StyleGuide: 'https://rails.rubystyle.guide#find_by'
267
+ Enabled: true
268
+ VersionAdded: '0.30'
269
+ Include:
270
+ - app/models/**/*.rb
271
+
272
+ Rails/FindById:
273
+ Description: >-
274
+ Favor the use of `find` over `where.take!`, `find_by!`, and `find_by_id!` when you
275
+ need to retrieve a single record by primary key when you expect it to be found.
276
+ StyleGuide: 'https://rails.rubystyle.guide/#find'
277
+ Enabled: 'pending'
278
+ VersionAdded: '2.7'
279
+
280
+ Rails/FindEach:
281
+ Description: 'Prefer all.find_each over all.find.'
282
+ StyleGuide: 'https://rails.rubystyle.guide#find-each'
283
+ Enabled: true
284
+ VersionAdded: '0.30'
285
+ VersionChanged: '2.9'
286
+ Include:
287
+ - app/models/**/*.rb
288
+ IgnoredMethods:
289
+ # Methods that don't work well with `find_each`.
290
+ - order
291
+ - limit
292
+ - select
293
+ - lock
294
+
295
+ Rails/HasAndBelongsToMany:
296
+ Description: 'Prefer has_many :through to has_and_belongs_to_many.'
297
+ StyleGuide: 'https://rails.rubystyle.guide#has-many-through'
298
+ Enabled: true
299
+ VersionAdded: '0.12'
300
+ Include:
301
+ - app/models/**/*.rb
302
+
303
+ Rails/HasManyOrHasOneDependent:
304
+ Description: 'Define the dependent option to the has_many and has_one associations.'
305
+ StyleGuide: 'https://rails.rubystyle.guide#has_many-has_one-dependent-option'
306
+ Enabled: true
307
+ VersionAdded: '0.50'
308
+ Include:
309
+ - app/models/**/*.rb
310
+
311
+ Rails/HelperInstanceVariable:
312
+ Description: 'Do not use instance variables in helpers.'
313
+ Enabled: true
314
+ VersionAdded: '2.0'
315
+ Include:
316
+ - app/helpers/**/*.rb
317
+
318
+ Rails/HttpPositionalArguments:
319
+ Description: 'Use keyword arguments instead of positional arguments in http method calls.'
320
+ Enabled: true
321
+ VersionAdded: '0.44'
322
+ Include:
323
+ - 'spec/**/*'
324
+ - 'test/**/*'
325
+
326
+ Rails/HttpStatus:
327
+ Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
328
+ Enabled: true
329
+ VersionAdded: '0.54'
330
+ EnforcedStyle: symbolic
331
+ SupportedStyles:
332
+ - numeric
333
+ - symbolic
334
+
335
+ Rails/IgnoredSkipActionFilterOption:
336
+ Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.'
337
+ Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options'
338
+ Enabled: true
339
+ VersionAdded: '0.63'
340
+ Include:
341
+ - app/controllers/**/*.rb
342
+
343
+ Rails/IndexBy:
344
+ Description: 'Prefer `index_by` over `each_with_object`, `to_h`, or `map`.'
345
+ Enabled: true
346
+ VersionAdded: '2.5'
347
+ VersionChanged: '2.8'
348
+
349
+ Rails/IndexWith:
350
+ Description: 'Prefer `index_with` over `each_with_object`, `to_h`, or `map`.'
351
+ Enabled: true
352
+ VersionAdded: '2.5'
353
+ VersionChanged: '2.8'
354
+
355
+ Rails/Inquiry:
356
+ Description: "Prefer Ruby's comparison operators over Active Support's `Array#inquiry` and `String#inquiry`."
357
+ StyleGuide: 'https://rails.rubystyle.guide/#inquiry'
358
+ Enabled: 'pending'
359
+ VersionAdded: '2.7'
360
+
361
+ Rails/InverseOf:
362
+ Description: 'Checks for associations where the inverse cannot be determined automatically.'
363
+ Enabled: true
364
+ VersionAdded: '0.52'
365
+ Include:
366
+ - app/models/**/*.rb
367
+
368
+ Rails/LexicallyScopedActionFilter:
369
+ Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
370
+ StyleGuide: 'https://rails.rubystyle.guide#lexically-scoped-action-filter'
371
+ Enabled: true
372
+ Safe: false
373
+ VersionAdded: '0.52'
374
+ Include:
375
+ - app/controllers/**/*.rb
376
+
377
+ Rails/LinkToBlank:
378
+ Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.'
379
+ Reference:
380
+ - https://mathiasbynens.github.io/rel-noopener/
381
+ - https://html.spec.whatwg.org/multipage/links.html#link-type-noopener
382
+ - https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer
383
+ Enabled: true
384
+ VersionAdded: '0.62'
385
+
386
+ Rails/MailerName:
387
+ Description: 'Mailer should end with `Mailer` suffix.'
388
+ StyleGuide: 'https://rails.rubystyle.guide/#mailer-name'
389
+ Enabled: 'pending'
390
+ SafeAutoCorrect: false
391
+ VersionAdded: '2.7'
392
+ Include:
393
+ - app/mailers/**/*.rb
394
+
395
+ Rails/MatchRoute:
396
+ Description: >-
397
+ Don't use `match` to define any routes unless there is a need to map multiple request types
398
+ among [:get, :post, :patch, :put, :delete] to a single action using the `:via` option.
399
+ StyleGuide: 'https://rails.rubystyle.guide/#no-match-routes'
400
+ Enabled: 'pending'
401
+ VersionAdded: '2.7'
402
+ Include:
403
+ - config/routes.rb
404
+ - config/routes/**/*.rb
405
+
406
+ Rails/NegateInclude:
407
+ Description: 'Prefer `collection.exclude?(obj)` over `!collection.include?(obj)`.'
408
+ StyleGuide: 'https://rails.rubystyle.guide#exclude'
409
+ Enabled: 'pending'
410
+ Safe: false
411
+ VersionAdded: '2.7'
412
+ VersionChanged: '2.9'
413
+
414
+ Rails/NotNullColumn:
415
+ Description: 'Do not add a NOT NULL column without a default value.'
416
+ Enabled: true
417
+ VersionAdded: '0.43'
418
+ Include:
419
+ - db/migrate/*.rb
420
+
421
+ Rails/OrderById:
422
+ Description: >-
423
+ Do not use the `id` column for ordering.
424
+ Use a timestamp column to order chronologically.
425
+ StyleGuide: 'https://rails.rubystyle.guide/#order-by-id'
426
+ Enabled: false
427
+ VersionAdded: '2.8'
428
+
429
+ Rails/Output:
430
+ Description: 'Checks for calls to puts, print, etc.'
431
+ Enabled: true
432
+ VersionAdded: '0.15'
433
+ VersionChanged: '0.19'
434
+ Include:
435
+ - app/**/*.rb
436
+ - config/**/*.rb
437
+ - db/**/*.rb
438
+ - lib/**/*.rb
439
+
440
+ Rails/OutputSafety:
441
+ Description: 'The use of `html_safe` or `raw` may be a security risk.'
442
+ Enabled: true
443
+ VersionAdded: '0.41'
444
+
445
+ Rails/Pick:
446
+ Description: 'Prefer `pick` over `pluck(...).first`.'
447
+ StyleGuide: 'https://rails.rubystyle.guide#pick'
448
+ Enabled: true
449
+ Safe: false
450
+ VersionAdded: '2.6'
451
+
452
+ Rails/Pluck:
453
+ Description: 'Prefer `pluck` over `map { ... }`.'
454
+ StyleGuide: 'https://rails.rubystyle.guide#pluck'
455
+ Enabled: 'pending'
456
+ VersionAdded: '2.7'
457
+
458
+ Rails/PluckId:
459
+ Description: 'Use `ids` instead of `pluck(:id)` or `pluck(primary_key)`.'
460
+ StyleGuide: 'https://rails.rubystyle.guide/#ids'
461
+ Enabled: false
462
+ Safe: false
463
+ VersionAdded: '2.7'
464
+
465
+ Rails/PluckInWhere:
466
+ Description: 'Use `select` instead of `pluck` in `where` query methods.'
467
+ Enabled: 'pending'
468
+ Safe: false
469
+ VersionAdded: '2.7'
470
+ VersionChanged: '2.8'
471
+ EnforcedStyle: conservative
472
+ SupportedStyles:
473
+ - conservative
474
+ - aggressive
475
+
476
+ Rails/PluralizationGrammar:
477
+ Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
478
+ Enabled: true
479
+ VersionAdded: '0.35'
480
+
481
+ Rails/Presence:
482
+ Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
483
+ Enabled: true
484
+ VersionAdded: '0.52'
485
+
486
+ Rails/Present:
487
+ Description: 'Enforces use of `present?`.'
488
+ Enabled: true
489
+ VersionAdded: '0.48'
490
+ VersionChanged: '0.67'
491
+ # Convert usages of `!nil? && !empty?` to `present?`
492
+ NotNilAndNotEmpty: true
493
+ # Convert usages of `!blank?` to `present?`
494
+ NotBlank: true
495
+ # Convert usages of `unless blank?` to `if present?`
496
+ UnlessBlank: true
497
+
498
+ Rails/RakeEnvironment:
499
+ Description: 'Include `:environment` as a dependency for all Rake tasks.'
500
+ Enabled: true
501
+ Safe: false
502
+ VersionAdded: '2.4'
503
+ VersionChanged: '2.6'
504
+ Include:
505
+ - '**/Rakefile'
506
+ - '**/*.rake'
507
+ Exclude:
508
+ - 'lib/capistrano/tasks/**/*.rake'
509
+
510
+ Rails/ReadWriteAttribute:
511
+ Description: >-
512
+ Checks for read_attribute(:attr) and
513
+ write_attribute(:attr, val).
514
+ StyleGuide: 'https://rails.rubystyle.guide#read-attribute'
515
+ Enabled: true
516
+ VersionAdded: '0.20'
517
+ VersionChanged: '0.29'
518
+ Include:
519
+ - app/models/**/*.rb
520
+
521
+ Rails/RedundantAllowNil:
522
+ Description: >-
523
+ Finds redundant use of `allow_nil` when `allow_blank` is set to
524
+ certain values in model validations.
525
+ Enabled: true
526
+ VersionAdded: '0.67'
527
+ Include:
528
+ - app/models/**/*.rb
529
+
530
+ Rails/RedundantForeignKey:
531
+ Description: 'Checks for associations where the `:foreign_key` option is redundant.'
532
+ Enabled: true
533
+ VersionAdded: '2.6'
534
+
535
+ Rails/RedundantReceiverInWithOptions:
536
+ Description: 'Checks for redundant receiver in `with_options`.'
537
+ Enabled: true
538
+ VersionAdded: '0.52'
539
+
540
+ Rails/ReflectionClassName:
541
+ Description: 'Use a string for `class_name` option value in the definition of a reflection.'
542
+ Enabled: true
543
+ VersionAdded: '0.64'
544
+
545
+ Rails/RefuteMethods:
546
+ Description: 'Use `assert_not` methods instead of `refute` methods.'
547
+ Enabled: true
548
+ VersionAdded: '0.56'
549
+ EnforcedStyle: assert_not
550
+ SupportedStyles:
551
+ - assert_not
552
+ - refute
553
+ Include:
554
+ - '**/test/**/*'
555
+
556
+ Rails/RelativeDateConstant:
557
+ Description: 'Do not assign relative date to constants.'
558
+ Enabled: true
559
+ VersionAdded: '0.48'
560
+ VersionChanged: '0.59'
561
+ AutoCorrect: false
562
+
563
+ Rails/RenderInline:
564
+ Description: 'Prefer using a template over inline rendering.'
565
+ StyleGuide: 'https://rails.rubystyle.guide/#inline-rendering'
566
+ Enabled: 'pending'
567
+ VersionAdded: '2.7'
568
+
569
+ Rails/RenderPlainText:
570
+ Description: 'Prefer `render plain:` over `render text:`.'
571
+ StyleGuide: 'https://rails.rubystyle.guide/#plain-text-rendering'
572
+ Enabled: 'pending'
573
+ VersionAdded: '2.7'
574
+ # Convert only when `content_type` is explicitly set to `text/plain`.
575
+ ContentTypeCompatibility: true
576
+
577
+ Rails/RequestReferer:
578
+ Description: 'Use consistent syntax for request.referer.'
579
+ Enabled: true
580
+ VersionAdded: '0.41'
581
+ EnforcedStyle: referer
582
+ SupportedStyles:
583
+ - referer
584
+ - referrer
585
+
586
+ Rails/ReversibleMigration:
587
+ Description: 'Checks whether the change method of the migration file is reversible.'
588
+ StyleGuide: 'https://rails.rubystyle.guide#reversible-migration'
589
+ Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
590
+ Enabled: true
591
+ VersionAdded: '0.47'
592
+ Include:
593
+ - db/migrate/*.rb
594
+
595
+ Rails/SafeNavigation:
596
+ Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`."
597
+ Enabled: true
598
+ VersionAdded: '0.43'
599
+ # This will convert usages of `try` to use safe navigation as well as `try!`.
600
+ # `try` and `try!` work slightly differently. `try!` and safe navigation will
601
+ # both raise a `NoMethodError` if the receiver of the method call does not
602
+ # implement the intended method. `try` will not raise an exception for this.
603
+ ConvertTry: false
604
+
605
+ Rails/SafeNavigationWithBlank:
606
+ Description: 'Avoid `foo&.blank?` in conditionals.'
607
+ Enabled: true
608
+ VersionAdded: '2.4'
609
+ # While the safe navigation operator is generally a good idea, when
610
+ # checking `foo&.blank?` in a conditional, `foo` being `nil` will actually
611
+ # do the opposite of what the author intends.
612
+ #
613
+ # foo&.blank? #=> nil
614
+ # foo.blank? #=> true
615
+ SafeAutoCorrect: false
616
+
617
+ Rails/SaveBang:
618
+ Description: 'Identifies possible cases where Active Record save! or related should be used.'
619
+ StyleGuide: 'https://rails.rubystyle.guide#save-bang'
620
+ Enabled: false
621
+ VersionAdded: '0.42'
622
+ VersionChanged: '0.59'
623
+ AllowImplicitReturn: true
624
+ AllowedReceivers: []
625
+ SafeAutoCorrect: false
626
+
627
+ Rails/ScopeArgs:
628
+ Description: 'Checks the arguments of ActiveRecord scopes.'
629
+ Enabled: true
630
+ VersionAdded: '0.19'
631
+ Include:
632
+ - app/models/**/*.rb
633
+
634
+ Rails/ShortI18n:
635
+ Description: 'Use the short form of the I18n methods: `t` instead of `translate` and `l` instead of `localize`.'
636
+ StyleGuide: 'https://rails.rubystyle.guide/#short-i18n'
637
+ Enabled: 'pending'
638
+ VersionAdded: '2.7'
639
+ EnforcedStyle: conservative
640
+ SupportedStyles:
641
+ - conservative
642
+ - aggressive
643
+
644
+ Rails/SkipsModelValidations:
645
+ Description: >-
646
+ Use methods that skips model validations with caution.
647
+ See reference for more information.
648
+ Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
649
+ Enabled: true
650
+ VersionAdded: '0.47'
651
+ VersionChanged: '2.7'
652
+ ForbiddenMethods:
653
+ - decrement!
654
+ - decrement_counter
655
+ - increment!
656
+ - increment_counter
657
+ - insert
658
+ - insert!
659
+ - insert_all
660
+ - insert_all!
661
+ - toggle!
662
+ - touch
663
+ - touch_all
664
+ - update_all
665
+ - update_attribute
666
+ - update_column
667
+ - update_columns
668
+ - update_counters
669
+ - upsert
670
+ - upsert_all
671
+ AllowedMethods: []
672
+
673
+ Rails/SquishedSQLHeredocs:
674
+ Description: 'Checks SQL heredocs to use `.squish`.'
675
+ StyleGuide: 'https://rails.rubystyle.guide/#squished-heredocs'
676
+ Enabled: 'pending'
677
+ VersionAdded: '2.8'
678
+ VersionChanged: '2.9'
679
+ # Some SQL syntax (e.g. PostgreSQL comments and functions) requires newlines
680
+ # to be preserved in order to work, thus auto-correction is not safe.
681
+ SafeAutoCorrect: false
682
+
683
+ Rails/TimeZone:
684
+ Description: 'Checks the correct usage of time zone aware methods.'
685
+ StyleGuide: 'https://rails.rubystyle.guide#time'
686
+ Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
687
+ Enabled: true
688
+ Safe: false
689
+ VersionAdded: '0.30'
690
+ VersionChanged: '0.68'
691
+ # The value `strict` means that `Time` should be used with `zone`.
692
+ # The value `flexible` allows usage of `in_time_zone` instead of `zone`.
693
+ EnforcedStyle: flexible
694
+ SupportedStyles:
695
+ - strict
696
+ - flexible
697
+
698
+ Rails/UniqBeforePluck:
699
+ Description: 'Prefer the use of uniq or distinct before pluck.'
700
+ Enabled: true
701
+ VersionAdded: '0.40'
702
+ VersionChanged: '2.8'
703
+ EnforcedStyle: conservative
704
+ SupportedStyles:
705
+ - conservative
706
+ - aggressive
707
+ SafeAutoCorrect: false
708
+ AutoCorrect: false
709
+
710
+ Rails/UniqueValidationWithoutIndex:
711
+ Description: 'Uniqueness validation should be with a unique index.'
712
+ Enabled: true
713
+ VersionAdded: '2.5'
714
+ Include:
715
+ - app/models/**/*.rb
716
+
717
+ Rails/UnknownEnv:
718
+ Description: 'Use correct environment name.'
719
+ Enabled: true
720
+ VersionAdded: '0.51'
721
+ Environments:
722
+ - development
723
+ - test
724
+ - production
725
+
726
+ Rails/Validation:
727
+ Description: 'Use validates :attribute, hash of validations.'
728
+ Enabled: true
729
+ VersionAdded: '0.9'
730
+ VersionChanged: '0.41'
731
+ Include:
732
+ - app/models/**/*.rb
733
+
734
+ Rails/WhereEquals:
735
+ Description: 'Pass conditions to `where` as a hash instead of manually constructing SQL.'
736
+ StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions'
737
+ Enabled: 'pending'
738
+ VersionAdded: '2.9'
739
+
740
+ Rails/WhereExists:
741
+ Description: 'Prefer `exists?(...)` over `where(...).exists?`.'
742
+ Enabled: 'pending'
743
+ EnforcedStyle: exists
744
+ SupportedStyles:
745
+ - exists
746
+ - where
747
+ VersionAdded: '2.7'
748
+ VersionChanged: '2.8'
749
+
750
+ Rails/WhereNot:
751
+ Description: 'Use `where.not(...)` instead of manually constructing negated SQL in `where`.'
752
+ StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions'
753
+ Enabled: 'pending'
754
+ VersionAdded: '2.8'
755
+
756
+ # Accept `redirect_to(...) and return` and similar cases.
757
+ Style/AndOr:
758
+ EnforcedStyle: conditionals
@@ -0,0 +1,5 @@
1
+ module Standard
2
+ module Rails
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ require_relative "rails/version"
2
+
3
+ module Standard
4
+ module Rails
5
+ class Error < StandardError; end
6
+ # Your code goes here...
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: standard-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Justin Searls
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-03-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop-rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.18.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.18.0
27
+ description:
28
+ email:
29
+ - searls@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".standard.yml"
35
+ - CHANGELOG.md
36
+ - Gemfile
37
+ - Gemfile.lock
38
+ - LICENSE.txt
39
+ - README.md
40
+ - Rakefile
41
+ - config/base.yml
42
+ - lib/standard/rails.rb
43
+ - lib/standard/rails/version.rb
44
+ homepage: https://github.com/testdouble/standard-rails
45
+ licenses:
46
+ - MIT
47
+ metadata:
48
+ homepage_uri: https://github.com/testdouble/standard-rails
49
+ source_code_uri: https://github.com/testdouble/standard-rails
50
+ changelog_uri: https://github.com/testdouble/standard-rails/blob/main/CHANGELOG.md
51
+ rubygems_mfa_required: 'true'
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 2.6.0
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubygems_version: 3.4.8
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: A Standard plugin that adds Rails-specific rules to Standard
71
+ test_files: []