|
| 1 | +# yaml-language-server: $schema=https://www.rubyschema.org/rubocop.json |
| 2 | +--- |
| 3 | +# Explicitly disable pending cops for now. This is the default behaviour but |
| 4 | +# this avoids a large warning every time we run it. |
| 5 | +# Stop RuboCop nagging about rubocop-rake. |
| 6 | +# Ensure that RuboCop validates according to the lowest version of Ruby that we support. |
| 7 | +AllCops: |
| 8 | + Exclude: |
| 9 | + - "bin/*" |
| 10 | + NewCops: enable |
| 11 | + SuggestExtensions: false |
| 12 | + TargetRubyVersion: 3.2 |
| 13 | + |
| 14 | +# Whether MFA is required or not should be left to the token configuration. |
| 15 | +Gemspec/RequireMFA: |
| 16 | + Enabled: false |
| 17 | + |
| 18 | +# Don't require this extra line break, it can be excessive. |
| 19 | +Layout/EmptyLineAfterGuardClause: |
| 20 | + Enabled: false |
| 21 | + |
| 22 | +# Don't leave complex assignment values hanging off to the right. |
| 23 | +Layout/EndAlignment: |
| 24 | + EnforcedStyleAlignWith: variable |
| 25 | + |
| 26 | +Layout/FirstArrayElementLineBreak: |
| 27 | + Enabled: true |
| 28 | + |
| 29 | +Layout/FirstHashElementLineBreak: |
| 30 | + Enabled: true |
| 31 | + |
| 32 | +Layout/FirstMethodArgumentLineBreak: |
| 33 | + Enabled: true |
| 34 | + |
| 35 | +Layout/FirstMethodParameterLineBreak: |
| 36 | + Enabled: true |
| 37 | + |
| 38 | +# Set a reasonable line length; rely on other cops to correct long lines. |
| 39 | +Layout/LineLength: |
| 40 | + AllowedPatterns: |
| 41 | + - "^\\s*#.*$" |
| 42 | + - ^require(_relative)? |
| 43 | + - "Stagehand::Internal::Type::BaseModel$" |
| 44 | + - "^\\s*[A-Z0-9_]+ = :" |
| 45 | + - "Stagehand::(Models|Resources|Test)::" |
| 46 | + Max: 110 |
| 47 | + |
| 48 | +Layout/MultilineArrayLineBreaks: |
| 49 | + Enabled: true |
| 50 | + |
| 51 | +# Start the assignment on the same line variable is mentioned. |
| 52 | +Layout/MultilineAssignmentLayout: |
| 53 | + EnforcedStyle: same_line |
| 54 | + |
| 55 | +Layout/MultilineHashKeyLineBreaks: |
| 56 | + Enabled: true |
| 57 | + |
| 58 | +Layout/MultilineMethodArgumentLineBreaks: |
| 59 | + Enabled: true |
| 60 | + |
| 61 | +Layout/MultilineMethodParameterLineBreaks: |
| 62 | + Enabled: true |
| 63 | + |
| 64 | +# Prefer compact hash literals. |
| 65 | +Layout/SpaceInsideHashLiteralBraces: |
| 66 | + EnforcedStyle: no_space |
| 67 | + Exclude: |
| 68 | + - "**/*.rbi" |
| 69 | + |
| 70 | +Lint/BooleanSymbol: |
| 71 | + Enabled: false |
| 72 | + |
| 73 | +# This option occasionally mangles identifier names |
| 74 | +Lint/DeprecatedConstants: |
| 75 | + Exclude: |
| 76 | + - "**/*.rbi" |
| 77 | + |
| 78 | +# We use pattern assertion in tests to ensure correctness. |
| 79 | +Lint/DuplicateMatchPattern: |
| 80 | + Exclude: |
| 81 | + - "test/**/*" |
| 82 | + |
| 83 | +# Fairly useful in tests for pattern assertions. |
| 84 | +Lint/EmptyInPattern: |
| 85 | + Exclude: |
| 86 | + - "test/**/*" |
| 87 | + |
| 88 | +Lint/MissingCopEnableDirective: |
| 89 | + Exclude: |
| 90 | + - "examples/**/*.rb" |
| 91 | + |
| 92 | +Lint/MissingSuper: |
| 93 | + Exclude: |
| 94 | + - "**/*.rbi" |
| 95 | + |
| 96 | +Lint/SymbolConversion: |
| 97 | + Exclude: |
| 98 | + - "**/*.rbi" |
| 99 | + |
| 100 | +# Disabled for safety reasons, this option changes code semantics. |
| 101 | +Lint/UnusedMethodArgument: |
| 102 | + AutoCorrect: false |
| 103 | + |
| 104 | +# This option is prone to causing accidental bugs. |
| 105 | +Lint/UselessAssignment: |
| 106 | + AutoCorrect: false |
| 107 | + Exclude: |
| 108 | + - "examples/**/*.rb" |
| 109 | + |
| 110 | +Metrics/AbcSize: |
| 111 | + Enabled: false |
| 112 | + |
| 113 | +Metrics/BlockLength: |
| 114 | + AllowedPatterns: |
| 115 | + - assert_pattern |
| 116 | + - type_alias |
| 117 | + - define_sorbet_constant! |
| 118 | + Exclude: |
| 119 | + - "**/*.rbi" |
| 120 | + |
| 121 | +Metrics/ClassLength: |
| 122 | + Enabled: false |
| 123 | + |
| 124 | +Metrics/CollectionLiteralLength: |
| 125 | + Exclude: |
| 126 | + - "test/**/*" |
| 127 | + |
| 128 | +Metrics/CyclomaticComplexity: |
| 129 | + Enabled: false |
| 130 | + |
| 131 | +Metrics/MethodLength: |
| 132 | + Enabled: false |
| 133 | + |
| 134 | +Metrics/ModuleLength: |
| 135 | + Enabled: false |
| 136 | + |
| 137 | +Metrics/ParameterLists: |
| 138 | + Enabled: false |
| 139 | + |
| 140 | +Metrics/PerceivedComplexity: |
| 141 | + Enabled: false |
| 142 | + |
| 143 | +Naming/AccessorMethodName: |
| 144 | + Enabled: false |
| 145 | + |
| 146 | +# Need to preserve block identifier for documentation. |
| 147 | +Naming/BlockForwarding: |
| 148 | + Enabled: false |
| 149 | + |
| 150 | +# Underscores are generally useful for disambiguation. |
| 151 | +Naming/ClassAndModuleCamelCase: |
| 152 | + Enabled: false |
| 153 | + |
| 154 | +Naming/MethodParameterName: |
| 155 | + Enabled: false |
| 156 | + |
| 157 | +Naming/PredicatePrefix: |
| 158 | + Exclude: |
| 159 | + - "**/*.rbi" |
| 160 | + |
| 161 | +Naming/VariableNumber: |
| 162 | + Enabled: false |
| 163 | + |
| 164 | +# Nothing wrong with inline private methods. |
| 165 | +Style/AccessModifierDeclarations: |
| 166 | + Enabled: false |
| 167 | + |
| 168 | +Style/AccessorGrouping: |
| 169 | + Exclude: |
| 170 | + - "**/*.rbi" |
| 171 | + |
| 172 | +# Behaviour of alias_method is more predictable. |
| 173 | +Style/Alias: |
| 174 | + EnforcedStyle: prefer_alias_method |
| 175 | + |
| 176 | +# And/or have confusing precedence, avoid them. |
| 177 | +Style/AndOr: |
| 178 | + EnforcedStyle: always |
| 179 | + |
| 180 | +Style/ArgumentsForwarding: |
| 181 | + Enabled: false |
| 182 | + |
| 183 | +Style/BisectedAttrAccessor: |
| 184 | + Exclude: |
| 185 | + - "**/*.rbi" |
| 186 | + |
| 187 | +# We prefer nested modules in lib/, but are currently using compact style for tests. |
| 188 | +Style/ClassAndModuleChildren: |
| 189 | + Exclude: |
| 190 | + - "test/**/*" |
| 191 | + |
| 192 | +Style/CommentAnnotation: |
| 193 | + Enabled: false |
| 194 | + |
| 195 | +# We should go back and add these docs, but ignore for now. |
| 196 | +Style/Documentation: |
| 197 | + Enabled: false |
| 198 | + |
| 199 | +# Allow explicit empty elses, for clarity. |
| 200 | +Style/EmptyElse: |
| 201 | + Enabled: false |
| 202 | + |
| 203 | +Style/EmptyMethod: |
| 204 | + Exclude: |
| 205 | + - "**/*.rbi" |
| 206 | + |
| 207 | +# We commonly use ENV['KEY'], it's OK. |
| 208 | +Style/FetchEnvVar: |
| 209 | + Enabled: false |
| 210 | + |
| 211 | +# Just to be safe, ensure nobody is mutating our internal strings. |
| 212 | +Style/FrozenStringLiteralComment: |
| 213 | + EnforcedStyle: always |
| 214 | + Exclude: |
| 215 | + - "**/*.rbi" |
| 216 | + |
| 217 | +# Nothing wrong with clear if statements. |
| 218 | +Style/IfUnlessModifier: |
| 219 | + Enabled: false |
| 220 | + |
| 221 | +# Rubocop is pretty bad about mangling single line lambdas. |
| 222 | +Style/Lambda: |
| 223 | + Enabled: false |
| 224 | + |
| 225 | +# Prefer consistency in method calling syntax. |
| 226 | +Style/MethodCallWithArgsParentheses: |
| 227 | + AllowedMethods: |
| 228 | + - raise |
| 229 | + Enabled: true |
| 230 | + Exclude: |
| 231 | + - "**/*.gemspec" |
| 232 | + |
| 233 | +Style/MultilineBlockChain: |
| 234 | + Enabled: false |
| 235 | + |
| 236 | +# Perfectly fine. |
| 237 | +Style/MultipleComparison: |
| 238 | + Enabled: false |
| 239 | + |
| 240 | +Style/MutableConstant: |
| 241 | + Exclude: |
| 242 | + - "**/*.rbi" |
| 243 | + |
| 244 | +# Not all parameters should be named. |
| 245 | +Style/NumberedParameters: |
| 246 | + Enabled: false |
| 247 | + |
| 248 | +Style/NumberedParametersLimit: |
| 249 | + Max: 2 |
| 250 | + |
| 251 | +# Reasonable to use brackets for errors with long messages. |
| 252 | +Style/RaiseArgs: |
| 253 | + Enabled: false |
| 254 | + |
| 255 | +# Be explicit about `RuntimeError`s. |
| 256 | +Style/RedundantException: |
| 257 | + Enabled: false |
| 258 | + |
| 259 | +Style/RedundantInitialize: |
| 260 | + Exclude: |
| 261 | + - "**/*.rbi" |
| 262 | + |
| 263 | +Style/RedundantParentheses: |
| 264 | + Exclude: |
| 265 | + - "**/*.rbi" |
| 266 | + |
| 267 | +# Prefer slashes for regex literals. |
| 268 | +Style/RegexpLiteral: |
| 269 | + EnforcedStyle: slashes |
| 270 | + |
| 271 | +# Allow explicit ifs, especially for imperative use. |
| 272 | +Style/SafeNavigation: |
| 273 | + Enabled: false |
| 274 | + |
| 275 | +Style/SignalException: |
| 276 | + Exclude: |
| 277 | + - Rakefile |
| 278 | + - "**/*.rake" |
| 279 | + |
| 280 | +# We use these sparingly, where we anticipate future branches for the |
| 281 | +# inner conditional. |
| 282 | +Style/SoleNestedConditional: |
| 283 | + Enabled: false |
| 284 | + |
| 285 | +# Prefer double quotes so that interpolation can be easily added. |
| 286 | +Style/StringLiterals: |
| 287 | + EnforcedStyle: double_quotes |
| 288 | + |
| 289 | +# Prefer explicit symbols for clarity; you can search for `:the_symbol`. |
| 290 | +Style/SymbolArray: |
| 291 | + EnforcedStyle: brackets |
| 292 | + |
| 293 | +# This option makes examples harder to read for ruby novices. |
| 294 | +Style/SymbolProc: |
| 295 | + Exclude: |
| 296 | + - "examples/**/*.rb" |
0 commit comments