ut-rubocop 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 21dfa4b9cf72296581bd0d64f8d1aa5646e208ebfa901658fa4a80b5a4322289
4
+ data.tar.gz: 39ccc541935d8a7c173b9dcbdc2cc052272a4ba68a844d7b293bd28bfca0e9ca
5
+ SHA512:
6
+ metadata.gz: f9569d275b7b5604c171bbc3e807870a0c576953388ba4f9e4bf712e0c60c45fcee665f8e0c3a6f62177a5f2774a2efcbb320a045ea5ce7fbe931aef8f0b834b
7
+ data.tar.gz: b4d498b1a0ce7fb5cab3adf0b380822450451b766eeeb0732f05db583cce8d907368089a3047b27349f6da05f91ba7ce540eab297f8bf24e6752f7ddfe49d187
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "ut/style_ruby/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ut-rubocop"
8
+ spec.version = UT::StyleRuby::Version::VERSION
9
+ spec.authors = ["Justin Aiken"]
10
+ spec.email = ["jaiken@usertesting.com"]
11
+ spec.description = %q{UT Rubocop}
12
+ spec.summary = %q{UserTesting's rubocop rules}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/).reject { |f| f.match(%r{^(spec|doc)/}) }
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "rubocop", "0.82.0"
22
+ spec.add_dependency "rubocop-rspec", "1.33.0"
23
+ spec.add_dependency "rubocop-performance", "1.5.2"
24
+ end
@@ -0,0 +1 @@
1
+ Gemfile.lock
@@ -0,0 +1 @@
1
+ inherit_from: default.yml
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,44 @@
1
+ # UT Rubocop
2
+
3
+ This is a basic extraction of common UserTesting ruby styles.
4
+ For rails focused styles, see [ut_rubocop_rails](https://github.com/usertesting/ut_rubocop_rails)
5
+
6
+ ## Installation
7
+
8
+ Add the gem to your `Gemfile` in the dev/test group:
9
+
10
+ You don't need to add `rubocop` itself, this takes care of that.
11
+
12
+ ```ruby
13
+ group :test, :development do
14
+ ...
15
+ gem "ut-rubocop", require: false
16
+ ```
17
+
18
+ In your `.rubocop.yml` file, add these lines near the top:
19
+
20
+ ```yaml
21
+ inherit_gem:
22
+ ut-rubocop:
23
+ - default.yml
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ `bundle exec rubocop`
29
+
30
+ ## License
31
+
32
+ [MIT](LICENSE).
33
+
34
+ Library created by [UserTesting](https://usertesting.com)
35
+
36
+ ![UserTesting](doc/UserTesting.png)
37
+
38
+ ## Contributing
39
+
40
+ 1. Fork it ( https://github.com/usertesting/ut_rubocop/fork )
41
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
42
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
43
+ 4. Push to the branch (`git push origin my-new-feature`)
44
+ 5. Create a new Pull Request
@@ -0,0 +1,409 @@
1
+ require:
2
+ - rubocop-rspec
3
+ - rubocop-performance
4
+
5
+ AllCops:
6
+ DisabledByDefault: true
7
+ DisplayCopNames: true
8
+ DisplayStyleGuide: true
9
+ Exclude:
10
+ - 'app/assets/**/*'
11
+ - '**/node_modules/**/*'
12
+ - 'yarn*'
13
+ - 'loader*'
14
+ - 'webpack*'
15
+ - 'gems/**/*'
16
+ - 'vendor/**/*'
17
+
18
+ # ------------------------------------ Bundler -------------------------------------------
19
+ Bundler/DuplicatedGem:
20
+ Enabled: true
21
+ # ------------------------------------ /Bundler ------------------------------------------
22
+
23
+ # ------------------------------------ Rspec/FactoryBot ----------------------------------
24
+ FactoryBot/AttributeDefinedStatically:
25
+ Description: 'Check for deprecated factory attribute assignments.'
26
+ Enabled: true
27
+ # ------------------------------------ /Rspec/FactoryBot ---------------------------------
28
+
29
+ # ------------------------------------ Lints ---------------------------------------------
30
+ Layout/BlockAlignment:
31
+ Enabled: true
32
+
33
+ Lint/CircularArgumentReference:
34
+ Enabled: true
35
+
36
+ Lint/Debugger:
37
+ Description: 'Check for `debugger` or `binding.pry` statements left in.'
38
+ Enabled: true
39
+ Exclude:
40
+ - bin/scripts/datacheck.rb
41
+ - spec/support/capybara.rb # Optional debugging tool not hit in regular codepaths
42
+
43
+ Lint/DeprecatedClassMethods:
44
+ Description: 'Check for deprecated class method calls.'
45
+ Enabled: true
46
+
47
+ Lint/DuplicateHashKey:
48
+ Description: 'Check for duplicate keys in hash literals.'
49
+ Enabled: true
50
+
51
+ Lint/DuplicateMethods:
52
+ Description: 'Check for duplicate method definitions.'
53
+ Enabled: true
54
+
55
+ Lint/EachWithObjectArgument:
56
+ Description: 'Check for immutable argument given to each_with_object.'
57
+ Enabled: true
58
+
59
+ Lint/ElseLayout:
60
+ Description: 'Check for odd code arrangement in an else block.'
61
+ Enabled: true
62
+
63
+ Lint/EmptyEnsure:
64
+ Description: 'Checks for empty ensure block.'
65
+ Enabled: true
66
+
67
+ Lint/EmptyInterpolation:
68
+ Description: 'Checks for empty string interpolation.'
69
+ Enabled: true
70
+
71
+ Style/EndBlock:
72
+ Description: 'END blocks should not be placed inside method definitions.'
73
+ Enabled: true
74
+
75
+ Lint/EnsureReturn:
76
+ Description: 'Do not use return in an ensure block.'
77
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-return-ensure'
78
+ Enabled: true
79
+
80
+ Lint/FlipFlop:
81
+ Enabled: true
82
+
83
+ Lint/FloatOutOfRange:
84
+ Description: >-
85
+ Catches floating-point literals too large or small for Ruby to
86
+ represent.
87
+ Enabled: true
88
+
89
+ Lint/FormatParameterMismatch:
90
+ Description: 'The number of parameters to format/sprint must match the fields.'
91
+ Enabled: true
92
+
93
+ Lint/ImplicitStringConcatenation:
94
+ Description: Checks for adjacent string literals on the same line, which could better be represented as a single string literal.
95
+ Enabled: true
96
+
97
+ Lint/InheritException:
98
+ Description: 'Avoid inheriting from the `Exception` class.'
99
+ Enabled: true
100
+
101
+ Lint/LiteralInInterpolation:
102
+ Description: 'Checks for literals used in interpolation.'
103
+ Enabled: true
104
+
105
+ Lint/Loop:
106
+ Enabled: true
107
+
108
+ Lint/NestedMethodDefinition:
109
+ Description: 'Do not use nested method definitions.'
110
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
111
+ Enabled: true
112
+
113
+ Lint/NextWithoutAccumulator:
114
+ Description: Do not omit the accumulator when calling `next` in a `reduce`/`inject` block.
115
+ Enabled: true
116
+
117
+ Lint/PercentStringArray:
118
+ Description: "Checks for unwanted commas and quotes in %w/%W literals."
119
+ Enabled: true
120
+
121
+ Lint/PercentSymbolArray:
122
+ Description: "Checks for unwanted commas and colons in %i/%I literals."
123
+ Enabled: true
124
+
125
+ Lint/RandOne:
126
+ Description: Checks for `rand(1)` calls. Such calls always return `0` and most likely a mistake.
127
+ Enabled: true
128
+
129
+ Lint/RescueException:
130
+ Description: 'Avoid rescuing the Exception class.'
131
+ StyleGuide: 'https://github.com/github/rubocop-github/blob/master/STYLEGUIDE.md#exceptions'
132
+ Enabled: true
133
+
134
+ Lint/ShadowedException:
135
+ Description: Avoid rescuing a higher level exception before a lower level exception.
136
+ Enabled: true
137
+
138
+ Lint/RedundantStringCoercion:
139
+ Enabled: true
140
+
141
+ Lint/UnderscorePrefixedVariableName:
142
+ Enabled: true
143
+
144
+ Lint/RedundantSplatExpansion:
145
+ Enabled: true
146
+
147
+ Layout/IndentationConsistency:
148
+ Description: Checks for inconsistent indentation.
149
+ Enabled: true
150
+ StyleGuide: 'https://rubystyle.guide#spaces-indentation'
151
+ EnforcedStyle: indented_internal_methods
152
+
153
+ Lint/UnreachableCode:
154
+ Description: 'Unreachable code.'
155
+ Enabled: true
156
+ Exclude:
157
+ - spec/lib/ut/cache_backed_mutex_spec.rb # Not truly unreachable
158
+
159
+ Lint/UnusedMethodArgument:
160
+ Description: 'Checks for unused method arguments.'
161
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
162
+ Enabled: true
163
+ Exclude:
164
+ - app/smart/**/*.rb # Smart does this by design w/ example resources
165
+ - app/decorators/**/*.rb # to_json(*args) shouldn't trigger this
166
+
167
+ Lint/UselessComparison:
168
+ Description: 'Checks for comparison of something with itself.'
169
+ Enabled: true
170
+
171
+ Lint/UselessElseWithoutRescue:
172
+ Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
173
+ Enabled: true
174
+
175
+ Lint/UselessSetterCall:
176
+ Description: 'Checks for useless setter call to a local variable.'
177
+ Enabled: true
178
+
179
+ Lint/Void:
180
+ Enabled: true
181
+
182
+ # ------------------------------------ /Lints -------------------------------------------
183
+
184
+ # ------------------------------------ Rails --------------------------------------------
185
+ Rails/Exit:
186
+ Description: >-
187
+ Favor `fail`, `break`, `return`, etc. over `exit` in
188
+ application or library code outside of Rake files to avoid
189
+ exits during unit testing or running in production.
190
+ Enabled: true
191
+
192
+ Rails/Output:
193
+ Description: 'Checks for calls to puts, print, etc.'
194
+ Enabled: true
195
+ Exclude:
196
+ - db/migrate/*.rb
197
+ - lib/perform_deployment.rb
198
+ - lib/asset_manifest.rb
199
+ - lib/chores/log.rb
200
+ - lib/generators/chore/chore_generator.rb
201
+
202
+ Rails/PluralizationGrammar:
203
+ Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
204
+ Enabled: true
205
+
206
+ Rails/ScopeArgs:
207
+ Description: 'Checks the arguments of ActiveRecord scopes.'
208
+ Enabled: true
209
+
210
+ Rails/UniqBeforePluck:
211
+ Description: 'Prefer the use of uniq or distinct before pluck.'
212
+ Enabled: true
213
+
214
+ Rails/ActiveRecordAliases:
215
+ Description: 'Checks that ActiveRecord aliases are not used. The direct method names are more clear and easier to read.'
216
+ Enabled: true
217
+
218
+ # ------------------------------------ /Rails --------------------------------------------
219
+
220
+
221
+ # ------------------------------------ Style --------------------------------------------
222
+ Style/ArrayJoin:
223
+ Enabled: true
224
+
225
+ Naming/AsciiIdentifiers:
226
+ Enabled: true
227
+
228
+ Style/BeginBlock:
229
+ Enabled: true
230
+
231
+ Style/BlockComments:
232
+ Enabled: true
233
+
234
+ Layout/BlockEndNewline:
235
+ Enabled: true
236
+
237
+ Style/CaseEquality:
238
+ Enabled: true
239
+
240
+ Style/CharacterLiteral:
241
+ Enabled: true
242
+
243
+ Naming/ClassAndModuleCamelCase:
244
+ Enabled: true
245
+
246
+ Style/ClassMethods:
247
+ Enabled: true
248
+
249
+ Style/DefWithParentheses:
250
+ Enabled: true
251
+
252
+ Layout/EndOfLine:
253
+ Enabled: true
254
+
255
+ Naming/FileName:
256
+ Enabled: true
257
+ ExpectMatchingDefinition: false
258
+ IgnoreExecutableScripts: true
259
+
260
+ Style/For:
261
+ Enabled: true
262
+
263
+ Style/FrozenStringLiteralComment:
264
+ Enabled: true
265
+ AutoCorrect: false
266
+
267
+ Layout/InitialIndentation:
268
+ Enabled: true
269
+
270
+ Style/LambdaCall:
271
+ Enabled: true
272
+
273
+ Style/MethodCallWithoutArgsParentheses:
274
+ Enabled: true
275
+
276
+ Style/MethodDefParentheses:
277
+ Enabled: true
278
+
279
+ Naming/MethodName:
280
+ Enabled: true
281
+ EnforcedStyle: snake_case
282
+ Exclude:
283
+ - spec/support/fresh_eyes_shared_code.rb #TesterA/TesterB makes sense
284
+
285
+ Style/MultilineIfThen:
286
+ Enabled: true
287
+
288
+ Style/NilComparison:
289
+ Enabled: true
290
+
291
+ Style/Not:
292
+ Enabled: true
293
+
294
+ Style/OneLineConditional:
295
+ Enabled: true
296
+
297
+ Style/RedundantSortBy:
298
+ Enabled: true
299
+
300
+ Style/Sample:
301
+ Enabled: true
302
+
303
+ Layout/SpaceAfterColon:
304
+ Enabled: true
305
+
306
+ Layout/SpaceAfterComma:
307
+ Enabled: true
308
+
309
+ Layout/SpaceAfterMethodName:
310
+ Enabled: true
311
+
312
+ Layout/SpaceAfterNot:
313
+ Enabled: true
314
+
315
+ Layout/SpaceAfterSemicolon:
316
+ Enabled: true
317
+
318
+ Layout/SpaceAroundBlockParameters:
319
+ Enabled: true
320
+
321
+ Layout/SpaceAroundEqualsInParameterDefault:
322
+ Enabled: true
323
+
324
+ Layout/SpaceInsideArrayPercentLiteral:
325
+ Enabled: true
326
+
327
+ Layout/SpaceInsideArrayLiteralBrackets:
328
+ Enabled: true
329
+
330
+ Layout/SpaceInsideReferenceBrackets:
331
+ Enabled: true
332
+
333
+ Layout/SpaceInsideParens:
334
+ Enabled: true
335
+
336
+ Layout/SpaceInsideRangeLiteral:
337
+ Enabled: true
338
+
339
+ Style/StabbyLambdaParentheses:
340
+ Enabled: true
341
+
342
+ Style/StringLiterals:
343
+ Enabled: true
344
+ EnforcedStyle: double_quotes
345
+
346
+ Style/Strip:
347
+ Enabled: true
348
+
349
+ Style/StructInheritance:
350
+ Description: 'Checks for inheritance from Struct.new.'
351
+ StyleGuide: '#no-extend-struct-new'
352
+ Enabled: true
353
+
354
+ Layout/IndentationStyle:
355
+ Enabled: true
356
+
357
+ Layout/TrailingEmptyLines:
358
+ Enabled: true
359
+ EnforcedStyle: final_newline
360
+
361
+ Layout/TrailingWhitespace:
362
+ Enabled: true
363
+
364
+ Layout/ConditionPosition:
365
+ Description: Checks for condition placed in a confusing position relative to the keyword.
366
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
367
+ Enabled: true
368
+
369
+ Layout/DefEndAlignment:
370
+ Description: "Makes sure def/ends line up"
371
+ Enabled: true
372
+
373
+
374
+ # ------------------------------------ /Style --------------------------------------------
375
+
376
+ # ------------------------------------ Performance -----------------------------------------
377
+ Performance/Count:
378
+ Enabled: true
379
+
380
+ Performance/Detect:
381
+ Enabled: true
382
+
383
+ Performance/DoubleStartEndWith:
384
+ Enabled: true
385
+
386
+ Performance/EndWith:
387
+ Enabled: true
388
+
389
+ Performance/FlatMap:
390
+ Enabled: true
391
+
392
+ Performance/RedundantMerge:
393
+ Enabled: true
394
+ MaxKeyValuePairs: 1
395
+
396
+ Performance/ReverseEach:
397
+ Enabled: true
398
+
399
+ Performance/Size:
400
+ Enabled: true
401
+
402
+ Performance/StartWith:
403
+ Enabled: true
404
+ # ------------------------------------ /Performance -----------------------------------------
405
+
406
+ # ------------------------------------ Security ---------------------------------------------
407
+ Security/Eval:
408
+ Enabled: true
409
+ # ------------------------------------ /Security --------------------------------------------
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ut/style_ruby/version"
4
+
5
+ module UT
6
+ module StyleRuby
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UT
4
+ module StyleRuby
5
+ module Version
6
+ VERSION = "0.0.1"
7
+ end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ut-rubocop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Justin Aiken
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-08-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.82.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.82.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop-rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.33.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.33.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop-performance
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 1.5.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.5.2
55
+ description: UT Rubocop
56
+ email:
57
+ - jaiken@usertesting.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gemspec"
63
+ - ".gitignore"
64
+ - ".rubocop.yml"
65
+ - Gemfile
66
+ - README.markdown
67
+ - default.yml
68
+ - lib/ut/style_ruby.rb
69
+ - lib/ut/style_ruby/version.rb
70
+ homepage: ''
71
+ licenses:
72
+ - MIT
73
+ metadata: {}
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubygems_version: 3.0.6
90
+ signing_key:
91
+ specification_version: 4
92
+ summary: UserTesting's rubocop rules
93
+ test_files: []