briard 2.4.2 → 2.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codeql-analysis.yml +72 -0
  3. data/.github/workflows/rubocop.yml +50 -0
  4. data/.gitignore +1 -0
  5. data/.rubocop.yml +144 -620
  6. data/.rubocop_todo.yml +76 -0
  7. data/CHANGELOG.md +18 -0
  8. data/Gemfile +2 -0
  9. data/Gemfile.lock +43 -9
  10. data/Rakefile +1 -1
  11. data/{bolognese.gemspec → briard.gemspec} +46 -39
  12. data/lib/briard/array.rb +2 -2
  13. data/lib/briard/author_utils.rb +79 -71
  14. data/lib/briard/cli.rb +12 -13
  15. data/lib/briard/crossref_utils.rb +73 -61
  16. data/lib/briard/datacite_utils.rb +132 -106
  17. data/lib/briard/doi_utils.rb +10 -10
  18. data/lib/briard/metadata.rb +96 -106
  19. data/lib/briard/metadata_utils.rb +87 -78
  20. data/lib/briard/readers/bibtex_reader.rb +65 -65
  21. data/lib/briard/readers/cff_reader.rb +88 -70
  22. data/lib/briard/readers/citeproc_reader.rb +90 -84
  23. data/lib/briard/readers/codemeta_reader.rb +68 -50
  24. data/lib/briard/readers/crosscite_reader.rb +2 -2
  25. data/lib/briard/readers/crossref_reader.rb +249 -210
  26. data/lib/briard/readers/datacite_json_reader.rb +3 -3
  27. data/lib/briard/readers/datacite_reader.rb +225 -189
  28. data/lib/briard/readers/npm_reader.rb +49 -42
  29. data/lib/briard/readers/ris_reader.rb +82 -80
  30. data/lib/briard/readers/schema_org_reader.rb +182 -159
  31. data/lib/briard/string.rb +1 -1
  32. data/lib/briard/utils.rb +4 -4
  33. data/lib/briard/version.rb +3 -1
  34. data/lib/briard/whitelist_scrubber.rb +11 -4
  35. data/lib/briard/writers/bibtex_writer.rb +14 -8
  36. data/lib/briard/writers/cff_writer.rb +33 -26
  37. data/lib/briard/writers/codemeta_writer.rb +19 -15
  38. data/lib/briard/writers/csv_writer.rb +6 -4
  39. data/lib/briard/writers/datacite_json_writer.rb +8 -2
  40. data/lib/briard/writers/jats_writer.rb +33 -28
  41. data/lib/briard/writers/rdf_xml_writer.rb +1 -1
  42. data/lib/briard/writers/ris_writer.rb +30 -18
  43. data/lib/briard/writers/turtle_writer.rb +1 -1
  44. data/lib/briard.rb +6 -6
  45. data/rubocop.sarif +0 -0
  46. data/spec/array_spec.rb +5 -5
  47. data/spec/author_utils_spec.rb +151 -132
  48. data/spec/datacite_utils_spec.rb +135 -83
  49. data/spec/doi_utils_spec.rb +168 -164
  50. data/spec/find_from_format_spec.rb +69 -69
  51. data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/onlies_keep_specific_tags.yml +65 -0
  52. data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/removes_a_tags.yml +65 -0
  53. data/spec/metadata_spec.rb +91 -90
  54. data/spec/readers/bibtex_reader_spec.rb +43 -38
  55. data/spec/readers/cff_reader_spec.rb +165 -153
  56. data/spec/readers/citeproc_reader_spec.rb +45 -40
  57. data/spec/readers/codemeta_reader_spec.rb +128 -115
  58. data/spec/readers/crosscite_reader_spec.rb +34 -24
  59. data/spec/readers/crossref_reader_spec.rb +1098 -939
  60. data/spec/readers/datacite_json_reader_spec.rb +53 -40
  61. data/spec/readers/datacite_reader_spec.rb +1541 -1337
  62. data/spec/readers/npm_reader_spec.rb +48 -43
  63. data/spec/readers/ris_reader_spec.rb +53 -47
  64. data/spec/readers/schema_org_reader_spec.rb +329 -267
  65. data/spec/spec_helper.rb +6 -5
  66. data/spec/utils_spec.rb +371 -347
  67. data/spec/writers/bibtex_writer_spec.rb +143 -143
  68. data/spec/writers/cff_writer_spec.rb +96 -90
  69. data/spec/writers/citation_writer_spec.rb +34 -33
  70. data/spec/writers/citeproc_writer_spec.rb +226 -224
  71. data/spec/writers/codemeta_writer_spec.rb +18 -16
  72. data/spec/writers/crosscite_writer_spec.rb +91 -73
  73. data/spec/writers/crossref_writer_spec.rb +99 -91
  74. data/spec/writers/csv_writer_spec.rb +70 -70
  75. data/spec/writers/datacite_json_writer_spec.rb +78 -68
  76. data/spec/writers/datacite_writer_spec.rb +417 -322
  77. data/spec/writers/jats_writer_spec.rb +177 -161
  78. data/spec/writers/rdf_xml_writer_spec.rb +68 -63
  79. data/spec/writers/ris_writer_spec.rb +162 -162
  80. data/spec/writers/schema_org_writer_spec.rb +329 -294
  81. data/spec/writers/turtle_writer_spec.rb +47 -47
  82. metadata +242 -166
  83. data/.github/workflows/release.yml +0 -47
data/.rubocop.yml CHANGED
@@ -1,658 +1,182 @@
1
- # from https://raw.githubusercontent.com/thoughtbot/guides/master/style/ruby/.rubocop.yml
2
- # modification: exclude "vendor/bundle/**/*"
3
-
4
- AllCops:
5
- Exclude:
6
- - db/schema.rb
7
- - vendor/bundle/**/*
1
+ # This is the configuration used to check the rubocop source code.
8
2
 
3
+ inherit_from: .rubocop_todo.yml
9
4
  require:
10
- - rubocop-rails
5
+ - rubocop/cop/internal_affairs
11
6
  - rubocop-performance
7
+ - rubocop-rspec
8
+ - rubocop-rake
12
9
 
13
- Naming/AccessorMethodName:
14
- Description: Check the naming of accessor methods for get_/set_.
15
- Enabled: false
16
-
17
- Style/Alias:
18
- Description: 'Use alias_method instead of alias.'
19
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
20
- Enabled: false
21
-
22
- Style/ArrayJoin:
23
- Description: 'Use Array#join instead of Array#*.'
24
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join'
25
- Enabled: false
26
-
27
- Style/AsciiComments:
28
- Description: 'Use only ascii symbols in comments.'
29
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
30
- Enabled: false
31
-
32
- Naming/AsciiIdentifiers:
33
- Description: 'Use only ascii symbols in identifiers.'
34
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
35
- Enabled: false
36
-
37
- Style/Attr:
38
- Description: 'Checks for uses of Module#attr.'
39
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr'
40
- Enabled: false
41
-
42
- Metrics/BlockNesting:
43
- Description: 'Avoid excessive block nesting'
44
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
45
- Enabled: false
46
-
47
- Style/CaseEquality:
48
- Description: 'Avoid explicit use of the case equality operator(===).'
49
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
50
- Enabled: false
51
-
52
- Style/CharacterLiteral:
53
- Description: 'Checks for uses of character literals.'
54
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
55
- Enabled: false
56
-
57
- Style/ClassAndModuleChildren:
58
- Description: 'Checks style of children classes and modules.'
59
- Enabled: true
60
- EnforcedStyle: nested
61
-
62
- Metrics/ClassLength:
63
- Description: 'Avoid classes longer than 100 lines of code.'
64
- Enabled: false
65
-
66
- Metrics/ModuleLength:
67
- Description: 'Avoid modules longer than 100 lines of code.'
68
- Enabled: false
69
-
70
- Style/ClassVars:
71
- Description: 'Avoid the use of class variables.'
72
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars'
73
- Enabled: false
74
-
75
- Style/CollectionMethods:
76
- Enabled: true
77
- PreferredMethods:
78
- find: detect
79
- inject: reduce
80
- collect: map
81
- find_all: select
82
-
83
- Style/ColonMethodCall:
84
- Description: 'Do not use :: for method call.'
85
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons'
86
- Enabled: false
87
-
88
- Style/CommentAnnotation:
89
- Description: >-
90
- Checks formatting of special comments
91
- (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
92
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
93
- Enabled: false
94
-
95
- Metrics/AbcSize:
96
- Description: >-
97
- A calculated magnitude based on number of assignments,
98
- branches, and conditions.
99
- Enabled: false
100
-
101
- Metrics/BlockLength:
102
- CountComments: true # count full line comments?
103
- Max: 25
104
- ExcludedMethods: []
10
+ AllCops:
11
+ NewCops: enable
105
12
  Exclude:
106
- - "spec/**/*"
107
-
108
- Metrics/CyclomaticComplexity:
109
- Description: >-
110
- A complexity metric that is strongly correlated to the number
111
- of test cases needed to validate a method.
112
- Enabled: false
113
-
114
- Rails/Delegate:
115
- Description: 'Prefer delegate method for delegations.'
116
- Enabled: false
117
-
118
- Style/PreferredHashMethods:
119
- Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
120
- StyleGuide: '#hash-key'
121
- Enabled: false
122
-
123
- Style/Documentation:
124
- Description: 'Document classes and non-namespace modules.'
125
- Enabled: false
126
-
127
- Style/DoubleNegation:
128
- Description: 'Checks for uses of double negation (!!).'
129
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
130
- Enabled: false
131
-
132
- Style/EachWithObject:
133
- Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
134
- Enabled: false
135
-
136
- Style/EmptyLiteral:
137
- Description: 'Prefer literals to Array.new/Hash.new/String.new.'
138
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#literal-array-hash'
139
- Enabled: false
140
-
141
- # Checks whether the source file has a utf-8 encoding comment or not
142
- # AutoCorrectEncodingComment must match the regex
143
- # /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
144
- Style/Encoding:
145
- Enabled: false
146
-
147
- Style/EvenOdd:
148
- Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
149
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
150
- Enabled: false
151
-
152
- Naming/FileName:
153
- Description: 'Use snake_case for source file names.'
154
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
155
- Enabled: false
156
-
157
- Style/FrozenStringLiteralComment:
158
- Description: >-
159
- Add the frozen_string_literal comment to the top of files
160
- to help transition from Ruby 2.3.0 to Ruby 3.0.
161
- Enabled: false
162
-
163
- Lint/FlipFlop:
164
- Description: 'Checks for flip flops'
165
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
166
- Enabled: false
167
-
168
- Style/FormatString:
169
- Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
170
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
171
- Enabled: false
172
-
173
- Style/GlobalVars:
174
- Description: 'Do not introduce global variables.'
175
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars'
176
- Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
177
- Enabled: false
178
-
179
- Style/GuardClause:
180
- Description: 'Check for conditionals that can be replaced with guard clauses'
181
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
182
- Enabled: false
183
-
184
- Style/IfUnlessModifier:
185
- Description: >-
186
- Favor modifier if/unless usage when you have a
187
- single-line body.
188
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
189
- Enabled: false
190
-
191
- Style/IfWithSemicolon:
192
- Description: 'Do not use if x; .... Use the ternary operator instead.'
193
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
194
- Enabled: false
195
-
196
- Style/InlineComment:
197
- Description: 'Avoid inline comments.'
198
- Enabled: false
199
-
200
- Style/Lambda:
201
- Description: 'Use the new lambda literal syntax for single-line blocks.'
202
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#lambda-multi-line'
203
- Enabled: false
204
-
205
- Style/LambdaCall:
206
- Description: 'Use lambda.call(...) instead of lambda.(...).'
207
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc-call'
208
- Enabled: false
209
-
210
- Style/LineEndConcatenation:
211
- Description: >-
212
- Use \ instead of + or << to concatenate two string literals at
213
- line end.
214
- Enabled: false
215
-
216
- Metrics/LineLength:
217
- Description: 'Limit lines to 80 characters.'
218
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
219
- Max: 80
220
-
221
- Metrics/MethodLength:
222
- Description: 'Avoid methods longer than 10 lines of code.'
223
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
224
- Enabled: false
225
-
226
- Style/ModuleFunction:
227
- Description: 'Checks for usage of `extend self` in modules.'
228
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function'
229
- Enabled: false
230
-
231
- Style/MultilineBlockChain:
232
- Description: 'Avoid multi-line chains of blocks.'
233
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
234
- Enabled: false
235
-
236
- Style/NegatedIf:
237
- Description: >-
238
- Favor unless over if for negative conditions
239
- (or control flow or).
240
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
241
- Enabled: false
242
-
243
- Style/NegatedWhile:
244
- Description: 'Favor until over while for negative conditions.'
245
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#until-for-negatives'
246
- Enabled: false
247
-
248
- Style/Next:
249
- Description: 'Use `next` to skip iteration instead of a condition at the end.'
250
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
251
- Enabled: false
252
-
253
- Style/NilComparison:
254
- Description: 'Prefer x.nil? to x == nil.'
255
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
256
- Enabled: false
257
-
258
- Style/Not:
259
- Description: 'Use ! instead of not.'
260
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not'
261
- Enabled: false
262
-
263
- Style/NumericLiterals:
264
- Description: >-
265
- Add underscores to large numeric literals to improve their
266
- readability.
267
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
268
- Enabled: false
269
-
270
- Style/OneLineConditional:
271
- Description: >-
272
- Favor the ternary operator(?:) over
273
- if/then/else/end constructs.
274
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
275
- Enabled: false
276
-
277
- Naming/BinaryOperatorParameterName:
278
- Description: 'When defining binary operators, name the argument other.'
279
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
280
- Enabled: false
281
-
282
- Metrics/ParameterLists:
283
- Description: 'Avoid parameter lists longer than three or four parameters.'
284
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
285
- Enabled: false
286
-
287
- Style/PercentLiteralDelimiters:
288
- Description: 'Use `%`-literal delimiters consistently'
289
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces'
290
- Enabled: false
291
-
292
- Style/PerlBackrefs:
293
- Description: 'Avoid Perl-style regex back references.'
294
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
295
- Enabled: false
13
+ - 'vendor/**/*'
14
+ - 'spec/fixtures/**/*'
15
+ - 'tmp/**/*'
16
+ - '.git/**/*'
17
+ - 'bin/*'
18
+ TargetRubyVersion: 2.6
19
+ SuggestExtensions: false
296
20
 
297
21
  Naming/PredicateName:
298
- Description: 'Check the names of predicate methods.'
299
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
300
- ForbiddenPrefixes:
301
- - is_
22
+ # Method define macros for dynamically generated method.
23
+ MethodDefinitionMacros:
24
+ - define_method
25
+ - define_singleton_method
26
+ - def_node_matcher
27
+ - def_node_search
28
+
29
+ Style/AccessorGrouping:
302
30
  Exclude:
303
- - spec/**/*
31
+ - lib/rubocop/formatter/base_formatter.rb
32
+ - lib/rubocop/cop/offense.rb
304
33
 
305
- Style/Proc:
306
- Description: 'Use proc instead of Proc.new.'
307
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc'
308
- Enabled: false
309
-
310
- Style/RaiseArgs:
311
- Description: 'Checks the arguments passed to raise/fail.'
312
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages'
313
- Enabled: false
314
-
315
- Style/RegexpLiteral:
316
- Description: 'Use / or %r around regular expressions.'
317
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
318
- Enabled: false
319
-
320
- Style/Sample:
321
- Description: >-
322
- Use `sample` instead of `shuffle.first`,
323
- `shuffle.last`, and `shuffle[Fixnum]`.
324
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
325
- Enabled: false
326
-
327
- Style/SelfAssignment:
328
- Description: >-
329
- Checks for places where self-assignment shorthand should have
330
- been used.
331
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
332
- Enabled: false
333
-
334
- Style/SingleLineBlockParams:
335
- Description: 'Enforces the names of some block params.'
336
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks'
337
- Enabled: false
338
-
339
- Style/SingleLineMethods:
340
- Description: 'Avoid single-line methods.'
341
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
342
- Enabled: false
343
-
344
- Style/SignalException:
345
- Description: 'Checks for proper usage of fail and raise.'
346
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'
347
- Enabled: false
348
-
349
- Style/SpecialGlobalVars:
350
- Description: 'Avoid Perl-style global variables.'
351
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms'
352
- Enabled: false
34
+ Style/FormatStringToken:
35
+ # Because we parse a lot of source codes from strings. Percent arrays
36
+ # look like unannotated format string tokens to this cop.
37
+ Exclude:
38
+ - spec/**/*
353
39
 
354
- Style/StringLiterals:
355
- Description: 'Checks if uses of quotes match the configured preference.'
356
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals'
357
- EnforcedStyle: double_quotes
358
- Enabled: true
40
+ Style/IpAddresses:
41
+ # The test for this cop includes strings that would cause offenses
42
+ Exclude:
43
+ - spec/rubocop/cop/style/ip_addresses_spec.rb
359
44
 
360
- Style/TrailingCommaInArguments:
361
- Description: 'Checks for trailing comma in argument lists.'
362
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
363
- EnforcedStyleForMultiline: comma
364
- SupportedStylesForMultiline:
365
- - comma
366
- - consistent_comma
367
- - no_comma
368
- Enabled: true
45
+ Layout/EndOfLine:
46
+ EnforcedStyle: lf
369
47
 
370
- Style/TrailingCommaInArrayLiteral:
371
- Description: 'Checks for trailing comma in array literals.'
372
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
373
- EnforcedStyleForMultiline: comma
374
- SupportedStylesForMultiline:
375
- - comma
376
- - consistent_comma
377
- - no_comma
48
+ Layout/ClassStructure:
378
49
  Enabled: true
379
50
 
380
- Style/TrailingCommaInHashLiteral:
381
- Description: 'Checks for trailing comma in hash literals.'
382
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
383
- EnforcedStyleForMultiline: comma
384
- SupportedStylesForMultiline:
385
- - comma
386
- - consistent_comma
387
- - no_comma
51
+ Layout/RedundantLineBreak:
388
52
  Enabled: true
389
53
 
390
- Style/TrivialAccessors:
391
- Description: 'Prefer attr_* methods to trivial readers/writers.'
392
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr_family'
393
- Enabled: false
394
-
395
- Style/VariableInterpolation:
396
- Description: >-
397
- Don't interpolate global, instance and class variables
398
- directly in strings.
399
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
400
- Enabled: false
401
-
402
- Style/WhenThen:
403
- Description: 'Use when x then ... for one-line cases.'
404
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#one-line-cases'
405
- Enabled: false
406
-
407
- Style/WhileUntilModifier:
408
- Description: >-
409
- Favor modifier while/until usage when you have a
410
- single-line body.
411
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
412
- Enabled: false
413
-
414
- Style/WordArray:
415
- Description: 'Use %w or %W for arrays of words.'
416
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
417
- Enabled: false
418
-
419
- # Layout
54
+ Layout/TrailingWhitespace:
55
+ AllowInHeredoc: false
420
56
 
421
- Layout/ParameterAlignment:
422
- Description: 'Here we check if the parameters on a multi-line method call or definition are aligned.'
423
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
424
- Enabled: false
57
+ Lint/AmbiguousBlockAssociation:
58
+ Exclude:
59
+ - 'spec/**/*.rb'
60
+
61
+ Layout/HashAlignment:
62
+ EnforcedHashRocketStyle:
63
+ - key
64
+ - table
65
+ EnforcedColonStyle:
66
+ - key
67
+ - table
68
+
69
+ Layout/LineLength:
70
+ Max: 100
71
+ AllowedPatterns:
72
+ - !ruby/regexp /\A +(it|describe|context|shared_examples|include_examples|it_behaves_like) ["']/
73
+
74
+ Lint/InterpolationCheck:
75
+ Exclude:
76
+ - 'spec/**/*.rb'
425
77
 
426
- Layout/ConditionPosition:
427
- Description: >-
428
- Checks for condition placed in a confusing position relative to
429
- the keyword.
430
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
431
- Enabled: false
78
+ Lint/UselessAccessModifier:
79
+ MethodCreatingMethods:
80
+ - 'def_matcher'
81
+ - 'def_node_matcher'
432
82
 
433
- Layout/DotPosition:
434
- Description: 'Checks the position of the dot in multi-line method calls.'
435
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
436
- EnforcedStyle: trailing
83
+ Metrics/BlockLength:
84
+ Exclude:
85
+ - 'Rakefile'
86
+ - '**/*.rake'
87
+ - 'spec/**/*.rb'
88
+ - '**/*.gemspec'
437
89
 
438
- Layout/ExtraSpacing:
439
- Description: 'Do not use unnecessary spacing.'
440
- Enabled: true
90
+ Metrics/ClassLength:
91
+ Exclude:
92
+ - lib/rubocop/config_obsoletion.rb
93
+ - lib/rubocop/options.rb
441
94
 
442
- Layout/MultilineOperationIndentation:
443
- Description: >-
444
- Checks indentation of binary operations that span more than
445
- one line.
446
- Enabled: true
447
- EnforcedStyle: indented
95
+ Metrics/ModuleLength:
96
+ Exclude:
97
+ - 'spec/**/*.rb'
448
98
 
449
- Layout/MultilineMethodCallIndentation:
450
- Description: >-
451
- Checks indentation of method calls with the dot operator
452
- that span more than one line.
99
+ Naming/InclusiveLanguage:
453
100
  Enabled: true
454
- EnforcedStyle: indented
455
-
456
- Layout/InitialIndentation:
457
- Description: >-
458
- Checks the indentation of the first non-blank non-comment line in a file.
459
- Enabled: false
460
-
461
- # Lint
462
-
463
- Lint/AmbiguousOperator:
464
- Description: >-
465
- Checks for ambiguous operators in the first argument of a
466
- method invocation without parentheses.
467
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
468
- Enabled: false
469
-
470
- Lint/AmbiguousRegexpLiteral:
471
- Description: >-
472
- Checks for ambiguous regexp literals in the first argument of
473
- a method invocation without parenthesis.
474
- Enabled: false
475
-
476
- Lint/AssignmentInCondition:
477
- Description: "Don't use assignment in conditions."
478
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
479
- Enabled: false
480
-
481
- Lint/CircularArgumentReference:
482
- Description: "Don't refer to the keyword argument in the default value."
483
- Enabled: false
484
-
485
- Lint/DeprecatedClassMethods:
486
- Description: 'Check for deprecated class method calls.'
487
- Enabled: false
488
-
489
- Lint/DuplicateHashKey:
490
- Description: 'Check for duplicate keys in hash literals.'
491
- Enabled: false
492
-
493
- Lint/EachWithObjectArgument:
494
- Description: 'Check for immutable argument given to each_with_object.'
495
- Enabled: false
496
-
497
- Lint/ElseLayout:
498
- Description: 'Check for odd code arrangement in an else block.'
499
- Enabled: false
500
-
501
- Lint/FormatParameterMismatch:
502
- Description: 'The number of parameters to format/sprint must match the fields.'
503
- Enabled: false
504
-
505
- Lint/SuppressedException:
506
- Description: "Don't suppress exception."
507
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
508
- Enabled: false
509
-
510
- Lint/LiteralAsCondition:
511
- Description: 'Checks of literals used in conditions.'
512
- Enabled: false
513
-
514
- Lint/LiteralInInterpolation:
515
- Description: 'Checks for literals used in interpolation.'
516
- Enabled: false
517
-
518
- Lint/Loop:
519
- Description: >-
520
- Use Kernel#loop with break rather than begin/end/until or
521
- begin/end/while for post-loop tests.
522
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
523
- Enabled: false
524
-
525
- Lint/NestedMethodDefinition:
526
- Description: 'Do not use nested method definitions.'
527
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
528
- Enabled: false
529
-
530
- Lint/NonLocalExitFromIterator:
531
- Description: 'Do not use return in iterator to cause non-local exit.'
532
- Enabled: false
533
-
534
- Lint/ParenthesesAsGroupedExpression:
535
- Description: >-
536
- Checks for method calls with a space before the opening
537
- parenthesis.
538
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
539
- Enabled: false
540
-
541
- Lint/RequireParentheses:
542
- Description: >-
543
- Use parentheses in the method call to avoid confusion
544
- about precedence.
545
- Enabled: false
546
-
547
- Lint/UnderscorePrefixedVariableName:
548
- Description: 'Do not use prefix `_` for a variable that is used.'
549
- Enabled: false
550
-
551
- Lint/RedundantCopDisableDirective:
552
- Description: >-
553
- Checks for rubocop:disable comments that can be removed.
554
- Note: this cop is not disabled when disabling all cops.
555
- It must be explicitly disabled.
556
- Enabled: false
557
-
558
- Lint/Void:
559
- Description: 'Possible use of operator/literal/variable in void context.'
560
- Enabled: false
561
-
562
- # Performance
563
-
564
- Performance/CaseWhenSplat:
565
- Description: >-
566
- Place `when` conditions that use splat at the end
567
- of the list of `when` branches.
568
- Enabled: false
569
-
570
- Performance/Count:
571
- Description: >-
572
- Use `count` instead of `select...size`, `reject...size`,
573
- `select...count`, `reject...count`, `select...length`,
574
- and `reject...length`.
575
- Enabled: false
576
-
577
- Performance/Detect:
578
- Description: >-
579
- Use `detect` instead of `select.first`, `find_all.first`,
580
- `select.last`, and `find_all.last`.
581
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
582
- Enabled: false
583
-
584
- Performance/FlatMap:
585
- Description: >-
586
- Use `Enumerable#flat_map`
587
- instead of `Enumerable#map...Array#flatten(1)`
588
- or `Enumberable#collect..Array#flatten(1)`
589
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
590
- Enabled: false
591
-
592
- Performance/ReverseEach:
593
- Description: 'Use `reverse_each` instead of `reverse.each`.'
594
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
595
- Enabled: false
101
+ CheckStrings: true
102
+ FlaggedTerms:
103
+ auto-correct:
104
+ Suggestions:
105
+ - autocorrect
106
+ auto_correct:
107
+ Suggestions:
108
+ - autocorrect
109
+ behaviour:
110
+ Suggestions:
111
+ - behavior
112
+ offence:
113
+ Suggestions:
114
+ - offense
115
+ Exclude:
116
+ - lib/rubocop/cop/naming/inclusive_language.rb
117
+ - lib/rubocop/cop/mixin/auto_corrector.rb
118
+ - spec/rubocop/cop/naming/inclusive_language_spec.rb
119
+
120
+ RSpec:
121
+ Language:
122
+ Expectations:
123
+ - expect_autocorrect_options_for_autocorrect
124
+ - expect_autocorrect_options_for_autocorrect_all
125
+ - expect_autocorrect_options_for_fix_layout
126
+ - expect_correction
127
+ - expect_feature_loader
128
+ - expect_no_offenses
129
+ - expect_offense
130
+
131
+ RSpec/FilePath:
132
+ Exclude:
133
+ - spec/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new_spec.rb
134
+ - spec/rubocop/formatter/junit_formatter_spec.rb
596
135
 
597
- Performance/Size:
598
- Description: >-
599
- Use `size` instead of `count` for counting
600
- the number of elements in `Array` and `Hash`.
601
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
602
- Enabled: false
136
+ RSpec/PredicateMatcher:
137
+ EnforcedStyle: explicit
603
138
 
604
- Performance/StringReplacement:
605
- Description: >-
606
- Use `tr` instead of `gsub` when you are replacing the same
607
- number of characters. Use `delete` instead of `gsub` when
608
- you are deleting characters.
609
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
610
- Enabled: false
139
+ RSpec/MessageSpies:
140
+ EnforcedStyle: receive
611
141
 
612
- # Rails
142
+ RSpec/NestedGroups:
143
+ Max: 7
613
144
 
614
- Rails/ActionFilter:
615
- Description: 'Enforces consistent use of action filter methods.'
145
+ RSpec/MultipleMemoizedHelpers:
616
146
  Enabled: false
617
147
 
618
- Rails/Date:
619
- Description: >-
620
- Checks the correct usage of date aware methods,
621
- such as Date.today, Date.current etc.
622
- Enabled: false
148
+ Performance/CollectionLiteralInLoop:
149
+ Exclude:
150
+ - 'Rakefile'
151
+ - 'spec/**/*.rb'
623
152
 
624
- Rails/FindBy:
625
- Description: 'Prefer find_by over where.first.'
626
- Enabled: false
153
+ Performance/EndWith:
154
+ SafeMultiline: false
627
155
 
628
- Rails/FindEach:
629
- Description: 'Prefer all.find_each over all.find.'
630
- Enabled: false
156
+ Performance/StartWith:
157
+ SafeMultiline: false
631
158
 
632
- Rails/HasAndBelongsToMany:
633
- Description: 'Prefer has_many :through to has_and_belongs_to_many.'
159
+ RSpec/StubbedMock:
634
160
  Enabled: false
635
161
 
636
- Rails/Output:
637
- Description: 'Checks for calls to puts, print, etc.'
638
- Enabled: false
162
+ InternalAffairs/ExampleDescription:
163
+ Include:
164
+ - 'spec/rubocop/cop/**/*.rb'
639
165
 
640
- Rails/ReadWriteAttribute:
641
- Description: >-
642
- Checks for read_attribute(:attr) and
643
- write_attribute(:attr, val).
644
- Enabled: false
166
+ InternalAffairs/UndefinedConfig:
167
+ Include:
168
+ - 'lib/rubocop/cop/**/*.rb'
169
+ Exclude:
170
+ - 'lib/rubocop/cop/correctors/**/*.rb'
171
+ - 'lib/rubocop/cop/mixin/**/*.rb'
645
172
 
646
- Rails/ScopeArgs:
647
- Description: 'Checks the arguments of ActiveRecord scopes.'
648
- Enabled: false
173
+ InternalAffairs/StyleDetectedApiUse:
174
+ Exclude:
175
+ - 'lib/rubocop/cop/mixin/percent_array.rb'
649
176
 
650
- Rails/TimeZone:
651
- Description: 'Checks the correct usage of time zone aware methods.'
652
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
653
- Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
654
- Enabled: false
177
+ InternalAffairs/NumblockHandler:
178
+ Exclude:
179
+ - 'lib/rubocop/cop/internal_affairs/*.rb'
655
180
 
656
- Rails/Validation:
657
- Description: 'Use validates :attribute, hash of validations.'
658
- Enabled: false
181
+ Gemspec/DependencyVersion:
182
+ Enabled: true