|
| 1 | +AllCops: |
| 2 | + TargetRubyVersion: 2.7 |
| 3 | + |
| 4 | + |
| 5 | +# Layout |
| 6 | + |
| 7 | +Layout/HashAlignment: |
| 8 | + EnforcedHashRocketStyle: table |
| 9 | + EnforcedColonStyle: table |
| 10 | + |
| 11 | +# Multi-line method chaining should be done with trailing dots. |
| 12 | +Layout/DotPosition: |
| 13 | + EnforcedStyle: leading |
| 14 | + SupportedStyles: |
| 15 | + - leading |
| 16 | + - trailing |
| 17 | + |
| 18 | + |
| 19 | +# Metrics |
| 20 | + |
| 21 | +Metrics/AbcSize: |
| 22 | + # The ABC size is a calculated magnitude, so this number can be a Fixnum or |
| 23 | + # a Float. |
| 24 | + Max: 20 |
| 25 | + |
| 26 | +Metrics/BlockLength: |
| 27 | + Description: 'Avoid long blocks with many lines.' |
| 28 | + Enabled: false |
| 29 | + |
| 30 | +Metrics/ClassLength: |
| 31 | + Max: 200 |
| 32 | + |
| 33 | +Metrics/LineLength: |
| 34 | + Max: 100 |
| 35 | + |
| 36 | + |
| 37 | +# Style |
| 38 | + |
| 39 | +Style/MutableConstant: |
| 40 | + Enabled: false |
| 41 | + |
| 42 | +Style/BlockDelimiters: |
| 43 | + EnforcedStyle: line_count_based |
| 44 | + SupportedStyles: |
| 45 | + # The `line_count_based` style enforces braces around single line blocks and |
| 46 | + # do..end around multi-line blocks. |
| 47 | + - line_count_based |
| 48 | + # The `semantic` style enforces braces around functional blocks, where the |
| 49 | + # primary purpose of the block is to return a value and do..end for |
| 50 | + # procedural blocks, where the primary purpose of the block is its |
| 51 | + # side-effects. |
| 52 | + # |
| 53 | + # This looks at the usage of a block's method to determine its type (e.g. is |
| 54 | + # the result of a `map` assigned to a variable or passed to another |
| 55 | + # method) but exceptions are permitted in the `ProceduralMethods`, |
| 56 | + # `FunctionalMethods` and `IgnoredMethods` sections below. |
| 57 | + - semantic |
| 58 | + # The `braces_for_chaining` style enforces braces around single line blocks |
| 59 | + # and do..end around multi-line blocks, except for multi-line blocks whose |
| 60 | + # return value is being chained with another method (in which case braces |
| 61 | + # are enforced). |
| 62 | + - braces_for_chaining |
| 63 | + ProceduralMethods: |
| 64 | + # Methods that are known to be procedural in nature but look functional from |
| 65 | + # their usage, e.g. |
| 66 | + # |
| 67 | + # time = Benchmark.realtime do |
| 68 | + # foo.bar |
| 69 | + # end |
| 70 | + # |
| 71 | + # Here, the return value of the block is discarded but the return value of |
| 72 | + # `Benchmark.realtime` is used. |
| 73 | + - benchmark |
| 74 | + - bm |
| 75 | + - bmbm |
| 76 | + - create |
| 77 | + - each_with_object |
| 78 | + - measure |
| 79 | + - new |
| 80 | + - realtime |
| 81 | + - tap |
| 82 | + - with_object |
| 83 | + FunctionalMethods: |
| 84 | + # Methods that are known to be functional in nature but look procedural from |
| 85 | + # their usage, e.g. |
| 86 | + # |
| 87 | + # let(:foo) { Foo.new } |
| 88 | + # |
| 89 | + # Here, the return value of `Foo.new` is used to define a `foo` helper but |
| 90 | + # doesn't appear to be used from the return value of `let`. |
| 91 | + - let |
| 92 | + - let! |
| 93 | + - subject |
| 94 | + - watch |
| 95 | + IgnoredMethods: |
| 96 | + # Methods that can be either procedural or functional and cannot be |
| 97 | + # categorised from their usage alone, e.g. |
| 98 | + # |
| 99 | + # foo = lambda do |x| |
| 100 | + # puts "Hello, #{x}" |
| 101 | + # end |
| 102 | + # |
| 103 | + # foo = lambda do |x| |
| 104 | + # x * 100 |
| 105 | + # end |
| 106 | + # |
| 107 | + # Here, it is impossible to tell from the return value of `lambda` whether |
| 108 | + # the inner block's return value is significant. |
| 109 | + - lambda |
| 110 | + - proc |
| 111 | + - it |
| 112 | + |
| 113 | +Style/Documentation: |
| 114 | + Description: 'Document classes and non-namespace modules.' |
| 115 | + Enabled: false |
| 116 | + Exclude: |
| 117 | + - 'spec/**/*' |
| 118 | + - 'test/**/*' |
| 119 | + |
| 120 | +Style/DoubleNegation: |
| 121 | + Description: 'Avoid the use of double negation (`!!`).' |
| 122 | + Enabled: false |
| 123 | + |
| 124 | +Style/MultilineBlockChain: |
| 125 | + Description: 'Avoid multi-line chains of blocks.' |
| 126 | + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks' |
| 127 | + Enabled: false |
0 commit comments