rubocop 0.67.2 → 0.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/config/default.yml +86 -233
- data/exe/rubocop +0 -12
- data/lib/rubocop.rb +13 -30
- data/lib/rubocop/ast/builder.rb +4 -0
- data/lib/rubocop/ast/node/alias_node.rb +24 -0
- data/lib/rubocop/ast/node/class_node.rb +31 -0
- data/lib/rubocop/ast/node/module_node.rb +24 -0
- data/lib/rubocop/ast/node/range_node.rb +7 -0
- data/lib/rubocop/ast/node/resbody_node.rb +12 -0
- data/lib/rubocop/ast/node/self_class_node.rb +24 -0
- data/lib/rubocop/cli.rb +40 -4
- data/lib/rubocop/config.rb +9 -7
- data/lib/rubocop/config_loader.rb +48 -7
- data/lib/rubocop/config_loader_resolver.rb +5 -4
- data/lib/rubocop/cop/commissioner.rb +24 -0
- data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +18 -6
- data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +12 -14
- data/lib/rubocop/cop/layout/access_modifier_indentation.rb +9 -20
- data/lib/rubocop/cop/layout/align_arguments.rb +93 -0
- data/lib/rubocop/cop/layout/align_parameters.rb +57 -33
- data/lib/rubocop/cop/layout/class_structure.rb +5 -5
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +6 -8
- data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +3 -6
- data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +1 -2
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +1 -0
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +292 -0
- data/lib/rubocop/cop/layout/{first_parameter_indentation.rb → indent_first_argument.rb} +11 -12
- data/lib/rubocop/cop/layout/{indent_array.rb → indent_first_array_element.rb} +2 -2
- data/lib/rubocop/cop/layout/{indent_hash.rb → indent_first_hash_element.rb} +2 -2
- data/lib/rubocop/cop/layout/indent_first_parameter.rb +96 -0
- data/lib/rubocop/cop/layout/indentation_width.rb +4 -16
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +2 -4
- data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +1 -16
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +1 -2
- data/lib/rubocop/cop/lint/duplicate_methods.rb +6 -8
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +4 -8
- data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +157 -0
- data/lib/rubocop/cop/lint/inherit_exception.rb +3 -4
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +18 -1
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +3 -5
- data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +25 -5
- data/lib/rubocop/cop/lint/useless_assignment.rb +2 -6
- data/lib/rubocop/cop/lint/useless_setter_call.rb +1 -2
- data/lib/rubocop/cop/message_annotator.rb +1 -0
- data/lib/rubocop/cop/metrics/line_length.rb +139 -28
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +3 -4
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +190 -0
- data/lib/rubocop/cop/mixin/{array_hash_indentation.rb → multiline_element_indentation.rb} +3 -2
- data/lib/rubocop/cop/mixin/too_many_lines.rb +3 -7
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +33 -4
- data/lib/rubocop/cop/rails/active_record_override.rb +23 -8
- data/lib/rubocop/cop/rails/delegate.rb +5 -8
- data/lib/rubocop/cop/rails/environment_comparison.rb +5 -3
- data/lib/rubocop/cop/rails/find_each.rb +1 -1
- data/lib/rubocop/cop/rails/redundant_allow_nil.rb +3 -3
- data/lib/rubocop/cop/rails/reflection_class_name.rb +1 -1
- data/lib/rubocop/cop/rails/skips_model_validations.rb +6 -7
- data/lib/rubocop/cop/rails/time_zone.rb +3 -10
- data/lib/rubocop/cop/rails/validation.rb +3 -0
- data/lib/rubocop/cop/registry.rb +3 -3
- data/lib/rubocop/cop/style/alias.rb +13 -7
- data/lib/rubocop/cop/style/block_delimiters.rb +20 -0
- data/lib/rubocop/cop/style/class_and_module_children.rb +19 -21
- data/lib/rubocop/cop/style/class_methods.rb +16 -24
- data/lib/rubocop/cop/style/conditional_assignment.rb +20 -49
- data/lib/rubocop/cop/style/documentation.rb +3 -7
- data/lib/rubocop/cop/style/format_string.rb +18 -21
- data/lib/rubocop/cop/style/hash_syntax.rb +1 -1
- data/lib/rubocop/cop/style/inverse_methods.rb +4 -0
- data/lib/rubocop/cop/style/lambda.rb +12 -8
- data/lib/rubocop/cop/style/mixin_grouping.rb +8 -10
- data/lib/rubocop/cop/style/module_function.rb +2 -3
- data/lib/rubocop/cop/style/next.rb +10 -14
- data/lib/rubocop/cop/style/one_line_conditional.rb +5 -3
- data/lib/rubocop/cop/style/optional_arguments.rb +1 -4
- data/lib/rubocop/cop/style/random_with_offset.rb +44 -47
- data/lib/rubocop/cop/style/redundant_return.rb +6 -14
- data/lib/rubocop/cop/style/redundant_sort_by.rb +1 -1
- data/lib/rubocop/cop/style/safe_navigation.rb +3 -0
- data/lib/rubocop/cop/style/struct_inheritance.rb +2 -3
- data/lib/rubocop/cop/style/symbol_proc.rb +20 -40
- data/lib/rubocop/cop/style/unless_else.rb +1 -2
- data/lib/rubocop/cop/style/yoda_condition.rb +8 -7
- data/lib/rubocop/cop/util.rb +2 -4
- data/lib/rubocop/file_finder.rb +5 -10
- data/lib/rubocop/formatter/disabled_config_formatter.rb +5 -0
- data/lib/rubocop/node_pattern.rb +304 -170
- data/lib/rubocop/options.rb +4 -1
- data/lib/rubocop/rspec/shared_contexts.rb +3 -0
- data/lib/rubocop/version.rb +1 -1
- data/lib/rubocop/yaml_duplication_checker.rb +1 -1
- metadata +26 -50
- data/lib/rubocop/cop/performance/caller.rb +0 -69
- data/lib/rubocop/cop/performance/case_when_splat.rb +0 -177
- data/lib/rubocop/cop/performance/casecmp.rb +0 -108
- data/lib/rubocop/cop/performance/chain_array_allocation.rb +0 -78
- data/lib/rubocop/cop/performance/compare_with_block.rb +0 -122
- data/lib/rubocop/cop/performance/count.rb +0 -102
- data/lib/rubocop/cop/performance/detect.rb +0 -110
- data/lib/rubocop/cop/performance/double_start_end_with.rb +0 -94
- data/lib/rubocop/cop/performance/end_with.rb +0 -56
- data/lib/rubocop/cop/performance/fixed_size.rb +0 -97
- data/lib/rubocop/cop/performance/flat_map.rb +0 -78
- data/lib/rubocop/cop/performance/inefficient_hash_search.rb +0 -99
- data/lib/rubocop/cop/performance/open_struct.rb +0 -46
- data/lib/rubocop/cop/performance/range_include.rb +0 -50
- data/lib/rubocop/cop/performance/redundant_block_call.rb +0 -93
- data/lib/rubocop/cop/performance/redundant_match.rb +0 -56
- data/lib/rubocop/cop/performance/redundant_merge.rb +0 -183
- data/lib/rubocop/cop/performance/regexp_match.rb +0 -265
- data/lib/rubocop/cop/performance/reverse_each.rb +0 -42
- data/lib/rubocop/cop/performance/size.rb +0 -77
- data/lib/rubocop/cop/performance/start_with.rb +0 -59
- data/lib/rubocop/cop/performance/string_replacement.rb +0 -173
- data/lib/rubocop/cop/performance/times_map.rb +0 -71
- data/lib/rubocop/cop/performance/unfreeze_string.rb +0 -50
- data/lib/rubocop/cop/performance/uri_default_parser.rb +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dba5f457f541be403c090a1e65bb79ecec9cb44d20caf6468f7dea47dc14074
|
4
|
+
data.tar.gz: f50ff42c73bd17159540297bc823e0979f1fdd26e8ccf0add7f371f99b6b3669
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6994e2accbbacb5dcd032aaff1fda0193165ed849ccb1483b52151066b3df1f9c4ce0c925caea2fd306b047a9d489da263ac3f9ff946a3c0298a2a276fde8f5f
|
7
|
+
data.tar.gz: b017c04fc55eeef70492a75495cf799a6a550bc8dd4f4e4802c68e16753d721f074b1d63439866d9c3535db2975f5763f2031d489fdf235aba4ee86f1428df8b
|
data/README.md
CHANGED
@@ -53,7 +53,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
|
|
53
53
|
might want to use a conservative version lock in your `Gemfile`:
|
54
54
|
|
55
55
|
```rb
|
56
|
-
gem 'rubocop', '~> 0.
|
56
|
+
gem 'rubocop', '~> 0.68.0', require: false
|
57
57
|
```
|
58
58
|
|
59
59
|
## Quickstart
|
data/config/default.yml
CHANGED
@@ -219,6 +219,34 @@ Layout/AccessModifierIndentation:
|
|
219
219
|
# But it can be overridden by setting this parameter
|
220
220
|
IndentationWidth: ~
|
221
221
|
|
222
|
+
Layout/AlignArguments:
|
223
|
+
Description: >-
|
224
|
+
Align the arguments of a method call if they span more
|
225
|
+
than one line.
|
226
|
+
StyleGuide: '#no-double-indent'
|
227
|
+
Enabled: true
|
228
|
+
VersionAdded: '0.68'
|
229
|
+
# Alignment of arguments in multi-line method calls.
|
230
|
+
#
|
231
|
+
# The `with_first_argument` style aligns the following lines along the same
|
232
|
+
# column as the first parameter.
|
233
|
+
#
|
234
|
+
# method_call(a,
|
235
|
+
# b)
|
236
|
+
#
|
237
|
+
# The `with_fixed_indentation` style aligns the following lines with one
|
238
|
+
# level of indentation relative to the start of the line with the method call.
|
239
|
+
#
|
240
|
+
# method_call(a,
|
241
|
+
# b)
|
242
|
+
EnforcedStyle: with_first_argument
|
243
|
+
SupportedStyles:
|
244
|
+
- with_first_argument
|
245
|
+
- with_fixed_indentation
|
246
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
247
|
+
# But it can be overridden by setting this parameter
|
248
|
+
IndentationWidth: ~
|
249
|
+
|
222
250
|
Layout/AlignArray:
|
223
251
|
Description: >-
|
224
252
|
Align the elements of an array literal if they span more than
|
@@ -305,23 +333,24 @@ Layout/AlignHash:
|
|
305
333
|
|
306
334
|
Layout/AlignParameters:
|
307
335
|
Description: >-
|
308
|
-
Align the parameters of a method
|
336
|
+
Align the parameters of a method definition if they span more
|
309
337
|
than one line.
|
310
338
|
StyleGuide: '#no-double-indent'
|
311
339
|
Enabled: true
|
312
340
|
VersionAdded: '0.49'
|
341
|
+
VersionChanged: '0.68'
|
313
342
|
# Alignment of parameters in multi-line method calls.
|
314
343
|
#
|
315
344
|
# The `with_first_parameter` style aligns the following lines along the same
|
316
345
|
# column as the first parameter.
|
317
346
|
#
|
318
|
-
#
|
319
|
-
#
|
347
|
+
# def method_foo(a,
|
348
|
+
# b)
|
320
349
|
#
|
321
350
|
# The `with_fixed_indentation` style aligns the following lines with one
|
322
351
|
# level of indentation relative to the start of the line with the method call.
|
323
352
|
#
|
324
|
-
#
|
353
|
+
# def method_foo(a,
|
325
354
|
# b)
|
326
355
|
EnforcedStyle: with_first_parameter
|
327
356
|
SupportedStyles:
|
@@ -616,11 +645,27 @@ Layout/FirstMethodParameterLineBreak:
|
|
616
645
|
Enabled: false
|
617
646
|
VersionAdded: '0.49'
|
618
647
|
|
619
|
-
Layout/
|
620
|
-
Description:
|
648
|
+
Layout/HeredocArgumentClosingParenthesis:
|
649
|
+
Description: >-
|
650
|
+
Checks for the placement of the closing parenthesis in a
|
651
|
+
method call that passes a HEREDOC string as an argument.
|
652
|
+
Enabled: false
|
653
|
+
VersionAdded: '0.68'
|
654
|
+
|
655
|
+
Layout/IndentAssignment:
|
656
|
+
Description: >-
|
657
|
+
Checks the indentation of the first line of the
|
658
|
+
right-hand-side of a multi-line assignment.
|
621
659
|
Enabled: true
|
622
660
|
VersionAdded: '0.49'
|
623
|
-
|
661
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
662
|
+
# But it can be overridden by setting this parameter
|
663
|
+
IndentationWidth: ~
|
664
|
+
|
665
|
+
Layout/IndentFirstArgument:
|
666
|
+
Description: 'Checks the indentation of the first argument in a method call.'
|
667
|
+
Enabled: true
|
668
|
+
VersionAdded: '0.68'
|
624
669
|
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
625
670
|
SupportedStyles:
|
626
671
|
# The first parameter should always be indented one step more than the
|
@@ -641,12 +686,12 @@ Layout/FirstParameterIndentation:
|
|
641
686
|
# But it can be overridden by setting this parameter
|
642
687
|
IndentationWidth: ~
|
643
688
|
|
644
|
-
Layout/
|
689
|
+
Layout/IndentFirstArrayElement:
|
645
690
|
Description: >-
|
646
691
|
Checks the indentation of the first element in an array
|
647
692
|
literal.
|
648
693
|
Enabled: true
|
649
|
-
VersionAdded: '0.
|
694
|
+
VersionAdded: '0.68'
|
650
695
|
# The value `special_inside_parentheses` means that array literals with
|
651
696
|
# brackets that have their opening bracket on the same line as a surrounding
|
652
697
|
# opening round parenthesis, shall have their first element indented relative
|
@@ -667,20 +712,10 @@ Layout/IndentArray:
|
|
667
712
|
# But it can be overridden by setting this parameter
|
668
713
|
IndentationWidth: ~
|
669
714
|
|
670
|
-
Layout/
|
671
|
-
Description: >-
|
672
|
-
Checks the indentation of the first line of the
|
673
|
-
right-hand-side of a multi-line assignment.
|
674
|
-
Enabled: true
|
675
|
-
VersionAdded: '0.49'
|
676
|
-
# By default, the indentation width from `Layout/IndentationWidth` is used
|
677
|
-
# But it can be overridden by setting this parameter
|
678
|
-
IndentationWidth: ~
|
679
|
-
|
680
|
-
Layout/IndentHash:
|
715
|
+
Layout/IndentFirstHashElement:
|
681
716
|
Description: 'Checks the indentation of the first key in a hash literal.'
|
682
717
|
Enabled: true
|
683
|
-
VersionAdded: '0.
|
718
|
+
VersionAdded: '0.68'
|
684
719
|
# The value `special_inside_parentheses` means that hash literals with braces
|
685
720
|
# that have their opening brace on the same line as a surrounding opening
|
686
721
|
# round parenthesis, shall have their first key indented relative to the
|
@@ -701,6 +736,21 @@ Layout/IndentHash:
|
|
701
736
|
# But it can be overridden by setting this parameter
|
702
737
|
IndentationWidth: ~
|
703
738
|
|
739
|
+
Layout/IndentFirstParameter:
|
740
|
+
Description: >-
|
741
|
+
Checks the indentation of the first parameter in a
|
742
|
+
method definition.
|
743
|
+
Enabled: true
|
744
|
+
VersionAdded: '0.49'
|
745
|
+
VersionChanged: '0.68'
|
746
|
+
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
747
|
+
SupportedStyles:
|
748
|
+
- consistent
|
749
|
+
- align_parentheses
|
750
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
751
|
+
# But it can be overridden by setting this parameter
|
752
|
+
IndentationWidth: ~
|
753
|
+
|
704
754
|
Layout/IndentHeredoc:
|
705
755
|
Description: 'This cop checks the indentation of the here document bodies.'
|
706
756
|
StyleGuide: '#squiggly-heredocs'
|
@@ -1310,6 +1360,13 @@ Lint/HandleExceptions:
|
|
1310
1360
|
Enabled: true
|
1311
1361
|
VersionAdded: '0.9'
|
1312
1362
|
|
1363
|
+
Lint/HeredocMethodCallPosition:
|
1364
|
+
Description: >-
|
1365
|
+
Checks for the ordering of a method call where
|
1366
|
+
the receiver of the call is a HEREDOC.
|
1367
|
+
Enabled: false
|
1368
|
+
VersionAdded: '0.68'
|
1369
|
+
|
1313
1370
|
Lint/ImplicitStringConcatenation:
|
1314
1371
|
Description: >-
|
1315
1372
|
Checks for adjacent string literals on the same line, which
|
@@ -1557,6 +1614,7 @@ Lint/UnderscorePrefixedVariableName:
|
|
1557
1614
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
1558
1615
|
Enabled: true
|
1559
1616
|
VersionAdded: '0.21'
|
1617
|
+
AllowKeywordBlockArguments: false
|
1560
1618
|
|
1561
1619
|
Lint/UnifiedInteger:
|
1562
1620
|
Description: 'Use Integer instead of Fixnum or Bignum'
|
@@ -1720,7 +1778,8 @@ Metrics/LineLength:
|
|
1720
1778
|
StyleGuide: '#80-character-limits'
|
1721
1779
|
Enabled: true
|
1722
1780
|
VersionAdded: '0.25'
|
1723
|
-
VersionChanged: '0.
|
1781
|
+
VersionChanged: '0.68'
|
1782
|
+
AutoCorrect: false
|
1724
1783
|
Max: 80
|
1725
1784
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
1726
1785
|
# containing a URI to be longer than Max.
|
@@ -1939,6 +1998,7 @@ Naming/RescuedExceptionsVariableName:
|
|
1939
1998
|
Description: 'Use consistent rescued exceptions variables naming.'
|
1940
1999
|
Enabled: true
|
1941
2000
|
VersionAdded: '0.67'
|
2001
|
+
VersionChanged: '0.68'
|
1942
2002
|
PreferredName: e
|
1943
2003
|
|
1944
2004
|
Naming/UncommunicativeBlockParamName:
|
@@ -2000,216 +2060,6 @@ Naming/VariableNumber:
|
|
2000
2060
|
- normalcase
|
2001
2061
|
- non_integer
|
2002
2062
|
|
2003
|
-
#################### Performance ###########################
|
2004
|
-
|
2005
|
-
Performance/Caller:
|
2006
|
-
Description: >-
|
2007
|
-
Use `caller(n..n)` instead of `caller`.
|
2008
|
-
Enabled: true
|
2009
|
-
VersionAdded: '0.49'
|
2010
|
-
|
2011
|
-
Performance/CaseWhenSplat:
|
2012
|
-
Description: >-
|
2013
|
-
Reordering `when` conditions with a splat to the end
|
2014
|
-
of the `when` branches can improve performance.
|
2015
|
-
Enabled: false
|
2016
|
-
AutoCorrect: false
|
2017
|
-
SafeAutoCorrect: false
|
2018
|
-
VersionAdded: '0.34'
|
2019
|
-
VersionChanged: '0.59'
|
2020
|
-
|
2021
|
-
Performance/Casecmp:
|
2022
|
-
Description: >-
|
2023
|
-
Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`..
|
2024
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
|
2025
|
-
Enabled: true
|
2026
|
-
VersionAdded: '0.36'
|
2027
|
-
|
2028
|
-
Performance/ChainArrayAllocation:
|
2029
|
-
Description: >-
|
2030
|
-
Instead of chaining array methods that allocate new arrays, mutate an
|
2031
|
-
existing array.
|
2032
|
-
Reference: 'https://twitter.com/schneems/status/1034123879978029057'
|
2033
|
-
Enabled: false
|
2034
|
-
VersionAdded: '0.59'
|
2035
|
-
|
2036
|
-
Performance/CompareWithBlock:
|
2037
|
-
Description: 'Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.'
|
2038
|
-
Enabled: true
|
2039
|
-
VersionAdded: '0.46'
|
2040
|
-
|
2041
|
-
Performance/Count:
|
2042
|
-
Description: >-
|
2043
|
-
Use `count` instead of `select...size`, `reject...size`,
|
2044
|
-
`select...count`, `reject...count`, `select...length`,
|
2045
|
-
and `reject...length`.
|
2046
|
-
# This cop has known compatibility issues with `ActiveRecord` and other
|
2047
|
-
# frameworks. ActiveRecord's `count` ignores the block that is passed to it.
|
2048
|
-
# For more information, see the documentation in the cop itself.
|
2049
|
-
# If you understand the known risk, you can disable `SafeMode`.
|
2050
|
-
SafeMode: true
|
2051
|
-
Enabled: true
|
2052
|
-
VersionAdded: '0.31'
|
2053
|
-
VersionChanged: '0.39'
|
2054
|
-
|
2055
|
-
Performance/Detect:
|
2056
|
-
Description: >-
|
2057
|
-
Use `detect` instead of `select.first`, `find_all.first`,
|
2058
|
-
`select.last`, and `find_all.last`.
|
2059
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
|
2060
|
-
# This cop has known compatibility issues with `ActiveRecord` and other
|
2061
|
-
# frameworks. `ActiveRecord` does not implement a `detect` method and `find`
|
2062
|
-
# has its own meaning. Correcting `ActiveRecord` methods with this cop
|
2063
|
-
# should be considered unsafe.
|
2064
|
-
SafeMode: true
|
2065
|
-
Enabled: true
|
2066
|
-
VersionAdded: '0.30'
|
2067
|
-
VersionChanged: '0.39'
|
2068
|
-
|
2069
|
-
Performance/DoubleStartEndWith:
|
2070
|
-
Description: >-
|
2071
|
-
Use `str.{start,end}_with?(x, ..., y, ...)`
|
2072
|
-
instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
|
2073
|
-
Enabled: true
|
2074
|
-
VersionAdded: '0.36'
|
2075
|
-
VersionChanged: '0.48'
|
2076
|
-
# Used to check for `starts_with?` and `ends_with?`.
|
2077
|
-
# These methods are defined by `ActiveSupport`.
|
2078
|
-
IncludeActiveSupportAliases: false
|
2079
|
-
|
2080
|
-
Performance/EndWith:
|
2081
|
-
Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.'
|
2082
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
|
2083
|
-
# This will change to a new method call which isn't guaranteed to be on the
|
2084
|
-
# object. Switching these methods has to be done with knowledge of the types
|
2085
|
-
# of the variables which rubocop doesn't have.
|
2086
|
-
SafeAutoCorrect: false
|
2087
|
-
AutoCorrect: false
|
2088
|
-
Enabled: true
|
2089
|
-
VersionAdded: '0.36'
|
2090
|
-
VersionChanged: '0.44'
|
2091
|
-
|
2092
|
-
Performance/FixedSize:
|
2093
|
-
Description: 'Do not compute the size of statically sized objects except in constants'
|
2094
|
-
Enabled: true
|
2095
|
-
VersionAdded: '0.35'
|
2096
|
-
|
2097
|
-
Performance/FlatMap:
|
2098
|
-
Description: >-
|
2099
|
-
Use `Enumerable#flat_map`
|
2100
|
-
instead of `Enumerable#map...Array#flatten(1)`
|
2101
|
-
or `Enumberable#collect..Array#flatten(1)`
|
2102
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
|
2103
|
-
Enabled: true
|
2104
|
-
VersionAdded: '0.30'
|
2105
|
-
EnabledForFlattenWithoutParams: false
|
2106
|
-
# If enabled, this cop will warn about usages of
|
2107
|
-
# `flatten` being called without any parameters.
|
2108
|
-
# This can be dangerous since `flat_map` will only flatten 1 level, and
|
2109
|
-
# `flatten` without any parameters can flatten multiple levels.
|
2110
|
-
|
2111
|
-
Performance/InefficientHashSearch:
|
2112
|
-
Description: 'Use `key?` or `value?` instead of `keys.include?` or `values.include?`'
|
2113
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashkey-instead-of-hashkeysinclude-code'
|
2114
|
-
Enabled: true
|
2115
|
-
VersionAdded: '0.56'
|
2116
|
-
Safe: false
|
2117
|
-
|
2118
|
-
Performance/OpenStruct:
|
2119
|
-
Description: 'Use `Struct` instead of `OpenStruct`.'
|
2120
|
-
Enabled: false
|
2121
|
-
VersionAdded: '0.61'
|
2122
|
-
Safe: false
|
2123
|
-
|
2124
|
-
Performance/RangeInclude:
|
2125
|
-
Description: 'Use `Range#cover?` instead of `Range#include?`.'
|
2126
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code'
|
2127
|
-
Enabled: true
|
2128
|
-
VersionAdded: '0.36'
|
2129
|
-
Safe: false
|
2130
|
-
|
2131
|
-
Performance/RedundantBlockCall:
|
2132
|
-
Description: 'Use `yield` instead of `block.call`.'
|
2133
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#proccall-and-block-arguments-vs-yieldcode'
|
2134
|
-
Enabled: true
|
2135
|
-
VersionAdded: '0.36'
|
2136
|
-
|
2137
|
-
Performance/RedundantMatch:
|
2138
|
-
Description: >-
|
2139
|
-
Use `=~` instead of `String#match` or `Regexp#match` in a context where the
|
2140
|
-
returned `MatchData` is not needed.
|
2141
|
-
Enabled: true
|
2142
|
-
VersionAdded: '0.36'
|
2143
|
-
|
2144
|
-
Performance/RedundantMerge:
|
2145
|
-
Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.'
|
2146
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
|
2147
|
-
Enabled: true
|
2148
|
-
VersionAdded: '0.36'
|
2149
|
-
# Max number of key-value pairs to consider an offense
|
2150
|
-
MaxKeyValuePairs: 2
|
2151
|
-
|
2152
|
-
Performance/RegexpMatch:
|
2153
|
-
Description: >-
|
2154
|
-
Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
|
2155
|
-
`Regexp#===`, or `=~` when `MatchData` is not used.
|
2156
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#regexp-vs-stringmatch-vs-string-vs-stringmatch-code-'
|
2157
|
-
Enabled: true
|
2158
|
-
VersionAdded: '0.47'
|
2159
|
-
|
2160
|
-
Performance/ReverseEach:
|
2161
|
-
Description: 'Use `reverse_each` instead of `reverse.each`.'
|
2162
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
|
2163
|
-
Enabled: true
|
2164
|
-
VersionAdded: '0.30'
|
2165
|
-
|
2166
|
-
Performance/Size:
|
2167
|
-
Description: >-
|
2168
|
-
Use `size` instead of `count` for counting
|
2169
|
-
the number of elements in `Array` and `Hash`.
|
2170
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code'
|
2171
|
-
Enabled: true
|
2172
|
-
VersionAdded: '0.30'
|
2173
|
-
|
2174
|
-
Performance/StartWith:
|
2175
|
-
Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.'
|
2176
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
|
2177
|
-
# This will change to a new method call which isn't guaranteed to be on the
|
2178
|
-
# object. Switching these methods has to be done with knowledge of the types
|
2179
|
-
# of the variables which rubocop doesn't have.
|
2180
|
-
SafeAutoCorrect: false
|
2181
|
-
AutoCorrect: false
|
2182
|
-
Enabled: true
|
2183
|
-
VersionAdded: '0.36'
|
2184
|
-
VersionChanged: '0.44'
|
2185
|
-
|
2186
|
-
Performance/StringReplacement:
|
2187
|
-
Description: >-
|
2188
|
-
Use `tr` instead of `gsub` when you are replacing the same
|
2189
|
-
number of characters. Use `delete` instead of `gsub` when
|
2190
|
-
you are deleting characters.
|
2191
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
|
2192
|
-
Enabled: true
|
2193
|
-
VersionAdded: '0.33'
|
2194
|
-
|
2195
|
-
Performance/TimesMap:
|
2196
|
-
Description: 'Checks for .times.map calls.'
|
2197
|
-
AutoCorrect: false
|
2198
|
-
Enabled: true
|
2199
|
-
VersionAdded: '0.36'
|
2200
|
-
VersionChanged: '0.50'
|
2201
|
-
SafeAutoCorrect: false # see https://github.com/rubocop-hq/rubocop/issues/4658
|
2202
|
-
|
2203
|
-
Performance/UnfreezeString:
|
2204
|
-
Description: 'Use unary plus to get an unfrozen string literal.'
|
2205
|
-
Enabled: true
|
2206
|
-
VersionAdded: '0.50'
|
2207
|
-
|
2208
|
-
Performance/UriDefaultParser:
|
2209
|
-
Description: 'Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.'
|
2210
|
-
Enabled: true
|
2211
|
-
VersionAdded: '0.50'
|
2212
|
-
|
2213
2063
|
#################### Rails #################################
|
2214
2064
|
|
2215
2065
|
# By default, the rails cops are not run. Override in project or home
|
@@ -2624,8 +2474,9 @@ Rails/TimeZone:
|
|
2624
2474
|
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#time'
|
2625
2475
|
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
|
2626
2476
|
Enabled: true
|
2477
|
+
Safe: false
|
2627
2478
|
VersionAdded: '0.30'
|
2628
|
-
VersionChanged: '0.
|
2479
|
+
VersionChanged: '0.68'
|
2629
2480
|
# The value `strict` means that `Time` should be used with `zone`.
|
2630
2481
|
# The value `flexible` allows usage of `in_time_zone` instead of `zone`.
|
2631
2482
|
EnforcedStyle: flexible
|
@@ -2819,6 +2670,8 @@ Style/BlockDelimiters:
|
|
2819
2670
|
# return value is being chained with another method (in which case braces
|
2820
2671
|
# are enforced).
|
2821
2672
|
- braces_for_chaining
|
2673
|
+
# The `always_braces` style always enforces braces.
|
2674
|
+
- always_braces
|
2822
2675
|
ProceduralMethods:
|
2823
2676
|
# Methods that are known to be procedural in nature but look functional from
|
2824
2677
|
# their usage, e.g.
|
data/exe/rubocop
CHANGED
@@ -9,18 +9,6 @@ require 'benchmark'
|
|
9
9
|
cli = RuboCop::CLI.new
|
10
10
|
result = 0
|
11
11
|
|
12
|
-
if defined?(Bundler)
|
13
|
-
gemfile_lock = Bundler.read_file(Bundler.default_lockfile)
|
14
|
-
parser = Bundler::LockfileParser.new(gemfile_lock)
|
15
|
-
|
16
|
-
unless parser.dependencies['rubocop-performance']
|
17
|
-
warn Rainbow(<<-MESSAGE.strip_indent).yellow.to_s
|
18
|
-
[Warn] Performance Cops will be removed from RuboCop 0.68. Use rubocop-performance gem instead.
|
19
|
-
https://github.com/rubocop-hq/rubocop/tree/master/manual/migrate_performance_cops.md
|
20
|
-
MESSAGE
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
12
|
time = Benchmark.realtime do
|
25
13
|
result = cli.run
|
26
14
|
end
|