cookstyle 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -2
- data/README.md +29 -17
- data/Rakefile +2 -0
- data/config/cookstyle.yml +80 -4
- data/config/disable_all.yml +75 -1
- data/config/disabled.yml +25 -35
- data/config/enabled.yml +373 -137
- data/config/upstream.yml +231 -11
- data/cookstyle.gemspec +1 -1
- data/lib/cookstyle/version.rb +2 -2
- metadata +7 -7
data/config/upstream.yml
CHANGED
@@ -25,6 +25,8 @@ AllCops:
|
|
25
25
|
- '**/Berksfile'
|
26
26
|
- '**/Cheffile'
|
27
27
|
- '**/Vagabondfile'
|
28
|
+
- '**/Fastfile'
|
29
|
+
- '**/*Fastfile'
|
28
30
|
Exclude:
|
29
31
|
- 'vendor/**/*'
|
30
32
|
# Default formatter will be used if no -f/--format option is given.
|
@@ -37,6 +39,9 @@ AllCops:
|
|
37
39
|
# behavior by overriding DisplayStyleGuide, or by giving the
|
38
40
|
# -S/--display-style-guide option.
|
39
41
|
DisplayStyleGuide: false
|
42
|
+
# When specifying style guide URLs, any paths and/or fragments will be
|
43
|
+
# evaluated relative to the base URL.
|
44
|
+
StyleGuideBaseURL: https://github.com/bbatsov/ruby-style-guide
|
40
45
|
# Extra details are not displayed in offense messages by default. Change
|
41
46
|
# behavior by overriding ExtraDetails, or by giving the
|
42
47
|
# -E/--extra-details option.
|
@@ -63,9 +68,20 @@ AllCops:
|
|
63
68
|
# which is "/tmp" on Unix-like systems, but could be something else on other
|
64
69
|
# systems.
|
65
70
|
CacheRootDirectory: /tmp
|
66
|
-
#
|
71
|
+
# The default cache root directory is /tmp, which on most systems is
|
72
|
+
# writable by any system user. This means that it is possible for a
|
73
|
+
# malicious user to anticipate the location of Rubocop's cache directory,
|
74
|
+
# and create a symlink in its place that could cause Rubocop to overwrite
|
75
|
+
# unintended files, or read malicious input. If you are certain that your
|
76
|
+
# cache location is secure from this kind of attack, and wish to use a
|
77
|
+
# symlinked cache location, set this value to "true".
|
78
|
+
AllowSymlinksInCacheRootDirectory: false
|
79
|
+
# What MRI version of the Ruby interpreter is the inspected code intended to
|
67
80
|
# run on? (If there is more than one, set this to the lowest version.)
|
68
|
-
TargetRubyVersion
|
81
|
+
# If a value is specified for TargetRubyVersion then it is used.
|
82
|
+
# Else if .ruby-version exists and it contains an MRI version it is used.
|
83
|
+
# Otherwise we fallback to the oldest officially supported Ruby version (2.1).
|
84
|
+
TargetRubyVersion: ~
|
69
85
|
|
70
86
|
# Indent private/protected/public as deep as method definitions
|
71
87
|
Style/AccessModifierIndentation:
|
@@ -165,6 +181,9 @@ Style/AlignParameters:
|
|
165
181
|
SupportedStyles:
|
166
182
|
- with_first_parameter
|
167
183
|
- with_fixed_indentation
|
184
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
185
|
+
# But it can be overridden by setting this parameter
|
186
|
+
IndentationWidth: ~
|
168
187
|
|
169
188
|
Style/AndOr:
|
170
189
|
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
@@ -379,6 +398,9 @@ Style/Copyright:
|
|
379
398
|
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
|
380
399
|
AutocorrectNotice: ''
|
381
400
|
|
401
|
+
Style/DocumentationMethod:
|
402
|
+
RequireForNonPublicMethods: false
|
403
|
+
|
382
404
|
# Multi-line method chaining should be done with leading dots.
|
383
405
|
Style/DotPosition:
|
384
406
|
EnforcedStyle: leading
|
@@ -413,22 +435,33 @@ Style/EmptyLinesAroundClassBody:
|
|
413
435
|
EnforcedStyle: no_empty_lines
|
414
436
|
SupportedStyles:
|
415
437
|
- empty_lines
|
438
|
+
- empty_lines_except_namespace
|
439
|
+
- empty_lines_special
|
416
440
|
- no_empty_lines
|
417
441
|
|
418
442
|
Style/EmptyLinesAroundModuleBody:
|
419
443
|
EnforcedStyle: no_empty_lines
|
420
444
|
SupportedStyles:
|
421
445
|
- empty_lines
|
446
|
+
- empty_lines_except_namespace
|
447
|
+
- empty_lines_special
|
422
448
|
- no_empty_lines
|
423
449
|
|
450
|
+
Style/EmptyMethod:
|
451
|
+
EnforcedStyle: compact
|
452
|
+
SupportedStyles:
|
453
|
+
- compact
|
454
|
+
- expanded
|
455
|
+
|
424
456
|
# Checks whether the source file has a utf-8 encoding comment or not
|
425
457
|
# AutoCorrectEncodingComment must match the regex
|
426
458
|
# /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
|
427
459
|
Style/Encoding:
|
428
|
-
EnforcedStyle:
|
460
|
+
EnforcedStyle: never
|
429
461
|
SupportedStyles:
|
430
462
|
- when_needed
|
431
463
|
- always
|
464
|
+
- never
|
432
465
|
AutoCorrectEncodingComment: '# encoding: utf-8'
|
433
466
|
|
434
467
|
Style/ExtraSpacing:
|
@@ -515,11 +548,18 @@ Style/GuardClause:
|
|
515
548
|
Style/HashSyntax:
|
516
549
|
EnforcedStyle: ruby19
|
517
550
|
SupportedStyles:
|
551
|
+
# checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
|
518
552
|
- ruby19
|
519
|
-
|
553
|
+
# checks for hash rocket syntax for all hashes
|
520
554
|
- hash_rockets
|
521
|
-
#
|
555
|
+
# forbids mixed key syntaxes (e.g. {a: 1, :b => 2})
|
556
|
+
- no_mixed_keys
|
557
|
+
# enforces both ruby19 and no_mixed_keys styles
|
558
|
+
- ruby19_no_mixed_keys
|
559
|
+
# Force hashes that have a symbol value to use hash rockets
|
522
560
|
UseHashRocketsWithSymbolValues: false
|
561
|
+
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
562
|
+
PreferHashRocketsForNonAlnumEndingSymbols: false
|
523
563
|
|
524
564
|
Style/IfUnlessModifier:
|
525
565
|
MaxLineLength: 80
|
@@ -590,6 +630,19 @@ Style/IndentHash:
|
|
590
630
|
# But it can be overridden by setting this parameter
|
591
631
|
IndentationWidth: ~
|
592
632
|
|
633
|
+
Style/Lambda:
|
634
|
+
EnforcedStyle: line_count_dependent
|
635
|
+
SupportedStyles:
|
636
|
+
- line_count_dependent
|
637
|
+
- lambda
|
638
|
+
- literal
|
639
|
+
|
640
|
+
Style/SpaceInLambdaLiteral:
|
641
|
+
EnforcedStyle: require_no_space
|
642
|
+
SupportedStyles:
|
643
|
+
- require_no_space
|
644
|
+
- require_space
|
645
|
+
|
593
646
|
Style/LambdaCall:
|
594
647
|
EnforcedStyle: call
|
595
648
|
SupportedStyles:
|
@@ -617,6 +670,16 @@ Style/NonNilCheck:
|
|
617
670
|
# offenses for `!x.nil?` and does no changes that might change behavior.
|
618
671
|
IncludeSemanticChanges: false
|
619
672
|
|
673
|
+
Style/NumericPredicate:
|
674
|
+
EnforcedStyle: predicate
|
675
|
+
SupportedStyles:
|
676
|
+
- predicate
|
677
|
+
- comparison
|
678
|
+
# Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
|
679
|
+
# false positives.
|
680
|
+
Exclude:
|
681
|
+
- 'spec/**/*'
|
682
|
+
|
620
683
|
Style/MethodDefParentheses:
|
621
684
|
EnforcedStyle: require_parentheses
|
622
685
|
SupportedStyles:
|
@@ -630,6 +693,22 @@ Style/MethodName:
|
|
630
693
|
- snake_case
|
631
694
|
- camelCase
|
632
695
|
|
696
|
+
Style/ModuleFunction:
|
697
|
+
EnforcedStyle: module_function
|
698
|
+
SupportedStyles:
|
699
|
+
- module_function
|
700
|
+
- extend_self
|
701
|
+
|
702
|
+
Style/MultilineArrayBraceLayout:
|
703
|
+
EnforcedStyle: symmetrical
|
704
|
+
SupportedStyles:
|
705
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
706
|
+
# new_line: closing brace is always on a new line
|
707
|
+
# same_line: closing brace is always on the same line as last element
|
708
|
+
- symmetrical
|
709
|
+
- new_line
|
710
|
+
- same_line
|
711
|
+
|
633
712
|
Style/MultilineAssignmentLayout:
|
634
713
|
# The types of assignments which are subject to this rule.
|
635
714
|
SupportedTypes:
|
@@ -648,15 +727,46 @@ Style/MultilineAssignmentLayout:
|
|
648
727
|
# for the set of supported types.
|
649
728
|
- new_line
|
650
729
|
|
730
|
+
Style/MultilineHashBraceLayout:
|
731
|
+
EnforcedStyle: symmetrical
|
732
|
+
SupportedStyles:
|
733
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
734
|
+
# new_line: closing brace is always on a new line
|
735
|
+
# same_line: closing brace is always on same line as last element
|
736
|
+
- symmetrical
|
737
|
+
- new_line
|
738
|
+
- same_line
|
739
|
+
|
740
|
+
Style/MultilineMethodCallBraceLayout:
|
741
|
+
EnforcedStyle: symmetrical
|
742
|
+
SupportedStyles:
|
743
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
744
|
+
# new_line: closing brace is always on a new line
|
745
|
+
# same_line: closing brace is always on the same line as last argument
|
746
|
+
- symmetrical
|
747
|
+
- new_line
|
748
|
+
- same_line
|
749
|
+
|
651
750
|
Style/MultilineMethodCallIndentation:
|
652
751
|
EnforcedStyle: aligned
|
653
752
|
SupportedStyles:
|
654
753
|
- aligned
|
655
754
|
- indented
|
755
|
+
- indented_relative_to_receiver
|
656
756
|
# By default, the indentation width from Style/IndentationWidth is used
|
657
757
|
# But it can be overridden by setting this parameter
|
658
758
|
IndentationWidth: ~
|
659
759
|
|
760
|
+
Style/MultilineMethodDefinitionBraceLayout:
|
761
|
+
EnforcedStyle: symmetrical
|
762
|
+
SupportedStyles:
|
763
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
764
|
+
# new_line: closing brace is always on a new line
|
765
|
+
# same_line: closing brace is always on the same line as last parameter
|
766
|
+
- symmetrical
|
767
|
+
- new_line
|
768
|
+
- same_line
|
769
|
+
|
660
770
|
Style/MultilineOperationIndentation:
|
661
771
|
EnforcedStyle: aligned
|
662
772
|
SupportedStyles:
|
@@ -669,6 +779,12 @@ Style/MultilineOperationIndentation:
|
|
669
779
|
Style/NumericLiterals:
|
670
780
|
MinDigits: 5
|
671
781
|
|
782
|
+
Style/NumericLiteralPrefix:
|
783
|
+
EnforcedOctalStyle: zero_with_o
|
784
|
+
SupportedOctalStyles:
|
785
|
+
- zero_with_o
|
786
|
+
- zero_only
|
787
|
+
|
672
788
|
Style/OptionHash:
|
673
789
|
# A list of parameter names that will be flagged by this cop.
|
674
790
|
SuspiciousParamNames:
|
@@ -686,6 +802,7 @@ Style/PercentLiteralDelimiters:
|
|
686
802
|
PreferredDelimiters:
|
687
803
|
'%': ()
|
688
804
|
'%i': ()
|
805
|
+
'%I': ()
|
689
806
|
'%q': ()
|
690
807
|
'%Q': ()
|
691
808
|
'%r': '{}'
|
@@ -715,6 +832,16 @@ Style/PredicateName:
|
|
715
832
|
# should still be accepted
|
716
833
|
NameWhitelist:
|
717
834
|
- is_a?
|
835
|
+
# Exclude Rspec specs because there is a strong convetion to write spec
|
836
|
+
# helpers in the form of `have_something` or `be_something`.
|
837
|
+
Exclude:
|
838
|
+
- 'spec/**/*'
|
839
|
+
|
840
|
+
Style/PreferredHashMethods:
|
841
|
+
EnforcedStyle: short
|
842
|
+
SupportedStyles:
|
843
|
+
- short
|
844
|
+
- verbose
|
718
845
|
|
719
846
|
Style/RaiseArgs:
|
720
847
|
EnforcedStyle: exploded
|
@@ -740,6 +867,11 @@ Style/RegexpLiteral:
|
|
740
867
|
# are found in the regexp string.
|
741
868
|
AllowInnerSlashes: false
|
742
869
|
|
870
|
+
Style/SafeNavigation:
|
871
|
+
# Safe navigation may cause a statement to start returning `nil` in addition
|
872
|
+
# to whatever it used to return.
|
873
|
+
ConvertCodeThatCanStartToReturnNil: false
|
874
|
+
|
743
875
|
Style/Semicolon:
|
744
876
|
# Allow ; to separate several expressions on the same line.
|
745
877
|
AllowAsExpressionSeparator: false
|
@@ -754,11 +886,11 @@ Style/SignalException:
|
|
754
886
|
Style/SingleLineBlockParams:
|
755
887
|
Methods:
|
756
888
|
- reduce:
|
757
|
-
-
|
758
|
-
-
|
889
|
+
- acc
|
890
|
+
- elem
|
759
891
|
- inject:
|
760
|
-
-
|
761
|
-
-
|
892
|
+
- acc
|
893
|
+
- elem
|
762
894
|
|
763
895
|
Style/SingleLineMethods:
|
764
896
|
AllowIfMethodIsEmpty: true
|
@@ -846,6 +978,9 @@ Style/SpaceInsideHashLiteralBraces:
|
|
846
978
|
SupportedStyles:
|
847
979
|
- space
|
848
980
|
- no_space
|
981
|
+
# 'compact' normally requires a space inside hash braces, with the exception
|
982
|
+
# that successive left braces or right braces are collapsed together
|
983
|
+
- compact
|
849
984
|
|
850
985
|
Style/SpaceInsideStringInterpolation:
|
851
986
|
EnforcedStyle: no_space
|
@@ -864,6 +999,15 @@ Style/SymbolProc:
|
|
864
999
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
865
1000
|
IgnoredMethods:
|
866
1001
|
- respond_to
|
1002
|
+
- define_method
|
1003
|
+
|
1004
|
+
Style/TernaryParentheses:
|
1005
|
+
EnforcedStyle: require_no_parentheses
|
1006
|
+
SupportedStyles:
|
1007
|
+
- require_parentheses
|
1008
|
+
- require_no_parentheses
|
1009
|
+
- require_parentheses_when_complex
|
1010
|
+
AllowSafeAssignment: true
|
867
1011
|
|
868
1012
|
Style/TrailingBlankLines:
|
869
1013
|
EnforcedStyle: final_newline
|
@@ -941,14 +1085,27 @@ Style/VariableName:
|
|
941
1085
|
- snake_case
|
942
1086
|
- camelCase
|
943
1087
|
|
1088
|
+
Style/VariableNumber:
|
1089
|
+
EnforcedStyle: normalcase
|
1090
|
+
SupportedStyles:
|
1091
|
+
- snake_case
|
1092
|
+
- normalcase
|
1093
|
+
- non_integer
|
1094
|
+
|
944
1095
|
Style/WhileUntilModifier:
|
945
1096
|
MaxLineLength: 80
|
946
1097
|
|
1098
|
+
# WordArray enforces how array literals of word-like strings should be expressed.
|
947
1099
|
Style/WordArray:
|
948
1100
|
EnforcedStyle: percent
|
949
1101
|
SupportedStyles:
|
1102
|
+
# percent style: %w(word1 word2)
|
950
1103
|
- percent
|
1104
|
+
# bracket style: ['word1', 'word2']
|
951
1105
|
- brackets
|
1106
|
+
# The MinSize option causes the WordArray rule to be ignored for arrays
|
1107
|
+
# smaller than a certain size. The rule is only applied to arrays
|
1108
|
+
# whose element count is greater than or equal to MinSize.
|
952
1109
|
MinSize: 0
|
953
1110
|
# The regular expression WordRegex decides what is considered a word.
|
954
1111
|
WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
|
@@ -956,7 +1113,7 @@ Style/WordArray:
|
|
956
1113
|
##################### Metrics ##################################
|
957
1114
|
|
958
1115
|
Metrics/AbcSize:
|
959
|
-
# The ABC size is a calculated magnitude, so this number can be
|
1116
|
+
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
960
1117
|
# a Float.
|
961
1118
|
Max: 15
|
962
1119
|
|
@@ -984,11 +1141,26 @@ Metrics/LineLength:
|
|
984
1141
|
URISchemes:
|
985
1142
|
- http
|
986
1143
|
- https
|
1144
|
+
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
|
1145
|
+
# directives like '# rubocop: enable ...' when calculating a line's length.
|
1146
|
+
IgnoreCopDirectives: false
|
1147
|
+
# The IgnoredPatterns option is a list of !ruby/regexp and/or string
|
1148
|
+
# elements. Strings will be converted to Regexp objects. A line that matches
|
1149
|
+
# any regular expression listed in this option will be ignored by LineLength.
|
1150
|
+
IgnoredPatterns: []
|
987
1151
|
|
988
1152
|
Metrics/MethodLength:
|
989
1153
|
CountComments: false # count full line comments?
|
990
1154
|
Max: 10
|
991
1155
|
|
1156
|
+
Metrics/BlockLength:
|
1157
|
+
CountComments: false # count full line comments?
|
1158
|
+
Max: 25
|
1159
|
+
Exclude:
|
1160
|
+
- 'Rakefile'
|
1161
|
+
- '**/*.rake'
|
1162
|
+
- 'spec/**/*.rb'
|
1163
|
+
|
992
1164
|
Metrics/ParameterLists:
|
993
1165
|
Max: 5
|
994
1166
|
CountKeywordArgs: true
|
@@ -1006,7 +1178,7 @@ Lint/AssignmentInCondition:
|
|
1006
1178
|
Lint/BlockAlignment:
|
1007
1179
|
# The value `start_of_block` means that the `end` should be aligned with line
|
1008
1180
|
# where the `do` keyword appears.
|
1009
|
-
# The value `start_of_line` means it should be aligned with the whole
|
1181
|
+
# The value `start_of_line` means it should be aligned with the whole
|
1010
1182
|
# expression's starting line.
|
1011
1183
|
# The value `either` means both are allowed.
|
1012
1184
|
AlignWith: either
|
@@ -1042,9 +1214,17 @@ Lint/DefEndAlignment:
|
|
1042
1214
|
- def
|
1043
1215
|
AutoCorrect: false
|
1044
1216
|
|
1217
|
+
Lint/InheritException:
|
1218
|
+
# The default base class in favour of `Exception`.
|
1219
|
+
EnforcedStyle: runtime_error
|
1220
|
+
SupportedStyles:
|
1221
|
+
- runtime_error
|
1222
|
+
- standard_error
|
1223
|
+
|
1045
1224
|
# Checks for unused block arguments
|
1046
1225
|
Lint/UnusedBlockArgument:
|
1047
1226
|
IgnoreEmptyBlocks: true
|
1227
|
+
AllowUnusedKeywordArguments: false
|
1048
1228
|
|
1049
1229
|
# Checks for unused method arguments.
|
1050
1230
|
Lint/UnusedMethodArgument:
|
@@ -1078,6 +1258,22 @@ Rails/Date:
|
|
1078
1258
|
- strict
|
1079
1259
|
- flexible
|
1080
1260
|
|
1261
|
+
Rails/DynamicFindBy:
|
1262
|
+
Whitelist:
|
1263
|
+
- find_by_sql
|
1264
|
+
|
1265
|
+
Rails/EnumUniqueness:
|
1266
|
+
Include:
|
1267
|
+
- app/models/**/*.rb
|
1268
|
+
|
1269
|
+
Rails/Exit:
|
1270
|
+
Include:
|
1271
|
+
- app/**/*.rb
|
1272
|
+
- config/**/*.rb
|
1273
|
+
- lib/**/*.rb
|
1274
|
+
Exclude:
|
1275
|
+
- lib/**/*.rake
|
1276
|
+
|
1081
1277
|
Rails/FindBy:
|
1082
1278
|
Include:
|
1083
1279
|
- app/models/**/*.rb
|
@@ -1090,6 +1286,10 @@ Rails/HasAndBelongsToMany:
|
|
1090
1286
|
Include:
|
1091
1287
|
- app/models/**/*.rb
|
1092
1288
|
|
1289
|
+
Rails/NotNullColumn:
|
1290
|
+
Include:
|
1291
|
+
- db/migrate/*.rb
|
1292
|
+
|
1093
1293
|
Rails/Output:
|
1094
1294
|
Include:
|
1095
1295
|
- app/**/*.rb
|
@@ -1101,6 +1301,19 @@ Rails/ReadWriteAttribute:
|
|
1101
1301
|
Include:
|
1102
1302
|
- app/models/**/*.rb
|
1103
1303
|
|
1304
|
+
Rails/RequestReferer:
|
1305
|
+
EnforcedStyle: referer
|
1306
|
+
SupportedStyles:
|
1307
|
+
- referer
|
1308
|
+
- referrer
|
1309
|
+
|
1310
|
+
Rails/SafeNavigation:
|
1311
|
+
# This will convert usages of `try` to use safe navigation as well as `try!`.
|
1312
|
+
# `try` and `try!` work slighly differently. `try!` and safe navigation will
|
1313
|
+
# both raise a `NoMethodError` if the receiver of the method call does not
|
1314
|
+
# implement the intended method. `try` will not raise an exception for this.
|
1315
|
+
ConvertTry: false
|
1316
|
+
|
1104
1317
|
Rails/ScopeArgs:
|
1105
1318
|
Include:
|
1106
1319
|
- app/models/**/*.rb
|
@@ -1113,6 +1326,13 @@ Rails/TimeZone:
|
|
1113
1326
|
- strict
|
1114
1327
|
- flexible
|
1115
1328
|
|
1329
|
+
Rails/UniqBeforePluck:
|
1330
|
+
EnforcedMode: conservative
|
1331
|
+
SupportedModes:
|
1332
|
+
- conservative
|
1333
|
+
- aggressive
|
1334
|
+
AutoCorrect: false
|
1335
|
+
|
1116
1336
|
Rails/Validation:
|
1117
1337
|
Include:
|
1118
1338
|
- app/models/**/*.rb
|