├── Gemfile ├── .rubocop-stub.yml ├── Gemfile.lock ├── LICENSE ├── README.md └── .rubocop.yml /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | ruby "3.0.2" 4 | 5 | source "https://rubygems.org" 6 | 7 | group :development, :test do 8 | gem "rubocop", "1.20" 9 | end 10 | -------------------------------------------------------------------------------- /.rubocop-stub.yml: -------------------------------------------------------------------------------- 1 | # _____ ____ ____ __ _ __ 2 | # / ___/ _____ ____ _ / __// __/____ / / (_)____ / /_ 3 | # \__ \ / ___// __ `// /_ / /_ / __ \ / / / // __ \ / __/ 4 | # ___/ // /__ / /_/ // __// __// /_/ // /___ / // / / // /_ 5 | # /____/ \___/ \__,_//_/ /_/ 1 \____//_____//_//_/ /_/ \__/ 6 | # 7 | # The linter file that doesn't lead junior developers to bad habits. 8 | # https://github.com/makersacademy/scaffolint 9 | # 10 | # Configure Rubocop to use the config file in the Scaffolint GitHub repo 11 | 12 | inherit_from: 13 | - https://raw.githubusercontent.com/makersacademy/scaffolint/v2.2.0/.rubocop.yml 14 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | ast (2.4.2) 5 | parallel (1.20.1) 6 | parser (3.0.2.0) 7 | ast (~> 2.4.1) 8 | rainbow (3.0.0) 9 | regexp_parser (2.1.1) 10 | rexml (3.2.5) 11 | rubocop (1.20.0) 12 | parallel (~> 1.10) 13 | parser (>= 3.0.0.0) 14 | rainbow (>= 2.2.2, < 4.0) 15 | regexp_parser (>= 1.8, < 3.0) 16 | rexml 17 | rubocop-ast (>= 1.9.1, < 2.0) 18 | ruby-progressbar (~> 1.7) 19 | unicode-display_width (>= 1.4.0, < 3.0) 20 | rubocop-ast (1.11.0) 21 | parser (>= 3.0.1.1) 22 | ruby-progressbar (1.11.0) 23 | unicode-display_width (2.0.0) 24 | 25 | PLATFORMS 26 | ruby 27 | 28 | DEPENDENCIES 29 | rubocop (= 1.20) 30 | 31 | RUBY VERSION 32 | ruby 3.0.2p107 33 | 34 | BUNDLED WITH 35 | 2.2.22 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Makers Academy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ScaffoLint 2 | 3 | The linter file that doesn't lead junior developers to bad habits. 4 | 5 | Read [.rubocop.yml](.rubocop.yml) for details. 6 | 7 | ## Quickstart 8 | 9 | 1. Add Rubocop to your `Gemfile` 10 | ```ruby 11 | group :development, :test do 12 | gem "rubocop", "1.20" 13 | end 14 | ``` 15 | 16 | 2. Run `bundle install` 17 | 18 | 3. Copy the ScaffoLint config file to your project 19 | ```shell 20 | ; curl -o .rubocop.yml https://raw.githubusercontent.com/makersacademy/scaffolint/v2.2.0/.rubocop-stub.yml 21 | ``` 22 | 23 | Or, if you already have a Rubocop config file, add the relevant lines from the [stub file](./.rubocop-stub.yml). 24 | 25 | 4. Gitignore the cached Rubocop file 26 | ```gitignore 27 | # File: .gitignore 28 | 29 | # Local cache of Rubocop remote config 30 | .rubocop-* 31 | ``` 32 | 33 | 5. Run `rubocop` 34 | 35 | ## Editor integration 36 | 37 | We recommend installing Rubocop support for your editor to get fast feedback as you write your code: 38 | 39 | - Visual Studio Code: [ruby-rubocop extension](https://marketplace.visualstudio.com/items?itemName=misogi.ruby-rubocop) 40 | - Atom: [linter-rubocop package](https://atom.io/packages/linter-rubocop) 41 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | # _____ ____ ____ __ _ __ 2 | # / ___/ _____ ____ _ / __// __/____ / / (_)____ / /_ 3 | # \__ \ / ___// __ `// /_ / /_ / __ \ / / / // __ \ / __/ 4 | # ___/ // /__ / /_/ // __// __// /_/ // /___ / // / / // /_ 5 | # /____/ \___/ \__,_//_/ /_/ 1 \____//_____//_//_/ /_/ \__/ 6 | # 7 | # The linter file that doesn't lead junior developers to bad habits. 8 | # https://github.com/makersacademy/scaffolint 9 | # 10 | # Problems (eg obselete names) may be due to an incompatible version. 11 | # Check your Rubocop version with `rubocop -v` in the command line. 12 | # 13 | # Tested with Rubocop version 1.20 14 | # 15 | # Introduction 16 | # ============ 17 | # 18 | # Our order of priorities: 19 | # 20 | # 1. Conforming your code to the styleguide. 21 | # 2. The styleguide being thorough and complete. 22 | # 23 | # This file relaxes Rubocop a bit so you can learn about code quality rather 24 | # than just following the rules. Some guidelines can result in worse code if you 25 | # don't know why they are there. For instance, if a line is too long, you might 26 | # be tempted to simply abbreviate your variable names - making your code harder 27 | # to read. 28 | # 29 | # We prioritize rules that offer good, easily incorporated feedback on improving 30 | # your code, without being overwhelming or requiring experienced judgement. 31 | # 32 | # As you become a better developer you will remove or amend this file according 33 | # to what you think good code should look like. 34 | # 35 | # Default Setup 36 | # ============= 37 | # 38 | # First, let's disable all rules. Then we can selectively re-enable the ones 39 | # we want. 40 | 41 | AllCops: 42 | DisabledByDefault: true 43 | SuggestExtensions: 44 | rubocop-rspec: false # Pending https://github.com/makersacademy/scaffolint/issues/7 45 | 46 | # Metrics 47 | # ======= 48 | # 49 | # Sometimes beginner devs interpret line or block length restrictions as a 50 | # reason to make things so abbreviated as to be unreadable. These messages are 51 | # designed to make you write more readable code - not less. 52 | # 53 | # We want to encourage testing, but it can be verbose in the early stages. 54 | # So we'll give you a break. As you learn, try removing the `Exclude` sections. 55 | 56 | Layout/LineLength: 57 | Enabled: true 58 | Exclude: 59 | - '**/spec/**/*' 60 | - '**/test/**/*' 61 | Max: 100 62 | 63 | Metrics/BlockLength: 64 | Enabled: true 65 | Exclude: 66 | - '**/spec/**/*' 67 | - '**/test/**/*' 68 | 69 | Metrics/AbcSize: 70 | Enabled: true 71 | Exclude: 72 | - '**/spec/**/*' 73 | - '**/test/**/*' 74 | 75 | Metrics/ClassLength: 76 | Enabled: true 77 | Exclude: 78 | - '**/spec/**/*' 79 | - '**/test/**/*' 80 | 81 | Metrics/MethodLength: 82 | Enabled: true 83 | Exclude: 84 | - '**/spec/**/*' 85 | - '**/test/**/*' 86 | 87 | Metrics/BlockNesting: 88 | Enabled: true 89 | Metrics/CyclomaticComplexity: 90 | Enabled: true 91 | Metrics/ModuleLength: 92 | Enabled: true 93 | Metrics/ParameterLists: 94 | Enabled: true 95 | Metrics/PerceivedComplexity: 96 | Enabled: true 97 | 98 | # Security 99 | # ======== 100 | # 101 | # We'll enable all of these. 102 | 103 | Security/Eval: 104 | Enabled: true 105 | Security/JSONLoad: 106 | Enabled: true 107 | Security/MarshalLoad: 108 | Enabled: true 109 | Security/Open: 110 | Enabled: true 111 | Security/YAMLLoad: 112 | Enabled: true 113 | 114 | # Code Style 115 | # ========== 116 | # 117 | # Many devs, upon running a linter for the first time, see a big wall of errors 118 | # of dubious necessity and put it in the 'way too much trouble' box. Beginners 119 | # usually have far more pressing concerns than which sort of quotes they use. 120 | # 121 | # This makes Rubocop have a bigger 'payoff' for beginners without so much of 122 | # the punishment. We focus our linting on things that significantly impact 123 | # readability, expressiveness, or teach a dev new things. For example: 124 | # 125 | # * Indentation & whitespace (inconsistency, really gross stuff like `a=1`) 126 | # * Easy wins in expressiveness (e.g. guard clauses — nice opportunity to 127 | # inject concretes) 128 | # * Egregious non-idiomatic ruby like `def getFilename` 129 | 130 | Bundler/DuplicatedGem: 131 | Enabled: true 132 | Bundler/InsecureProtocolSource: 133 | Enabled: true 134 | 135 | Layout/BlockAlignment: 136 | Enabled: true 137 | Layout/BlockEndNewline: 138 | Enabled: true 139 | Layout/ConditionPosition: 140 | Enabled: true 141 | Layout/DefEndAlignment: 142 | Enabled: true 143 | Layout/EndAlignment: 144 | Enabled: true 145 | Layout/DotPosition: 146 | Enabled: true 147 | Layout/ElseAlignment: 148 | Enabled: true 149 | Layout/EmptyLineBetweenDefs: 150 | Enabled: true 151 | Layout/EmptyLines: 152 | Enabled: true 153 | Layout/EmptyLinesAroundAccessModifier: 154 | Enabled: true 155 | Layout/EndOfLine: 156 | Enabled: true 157 | Layout/ExtraSpacing: 158 | Enabled: true 159 | Layout/IndentationConsistency: 160 | Enabled: true 161 | Layout/IndentationWidth: 162 | Enabled: true 163 | Layout/InitialIndentation: 164 | Enabled: true 165 | Layout/LeadingCommentSpace: 166 | Enabled: true 167 | Layout/SpaceAfterColon: 168 | Enabled: true 169 | Layout/SpaceAfterMethodName: 170 | Enabled: true 171 | Layout/SpaceAfterNot: 172 | Enabled: true 173 | Layout/SpaceAfterSemicolon: 174 | Enabled: true 175 | Layout/SpaceAroundBlockParameters: 176 | Enabled: true 177 | Layout/SpaceAroundEqualsInParameterDefault: 178 | Enabled: true 179 | Layout/SpaceAroundMethodCallOperator: 180 | Enabled: true 181 | Layout/SpaceAroundKeyword: 182 | Enabled: true 183 | Layout/SpaceAroundOperators: 184 | Enabled: true 185 | Layout/SpaceBeforeBlockBraces: 186 | Enabled: true 187 | Layout/SpaceBeforeBrackets: 188 | Enabled: true 189 | Layout/SpaceBeforeComma: 190 | Enabled: true 191 | Layout/SpaceBeforeComment: 192 | Enabled: true 193 | Layout/SpaceBeforeFirstArg: 194 | Enabled: true 195 | Layout/SpaceBeforeSemicolon: 196 | Enabled: true 197 | Layout/SpaceInLambdaLiteral: 198 | Enabled: true 199 | Layout/SpaceInsideArrayPercentLiteral: 200 | Enabled: true 201 | Layout/SpaceInsideBlockBraces: 202 | Enabled: true 203 | Layout/SpaceInsideReferenceBrackets: 204 | Enabled: true 205 | Layout/SpaceInsideArrayLiteralBrackets: 206 | Enabled: true 207 | Layout/SpaceInsideHashLiteralBraces: 208 | Enabled: true 209 | Layout/SpaceInsideParens: 210 | Enabled: true 211 | Layout/SpaceInsidePercentLiteralDelimiters: 212 | Enabled: true 213 | Layout/SpaceInsideRangeLiteral: 214 | Enabled: true 215 | Layout/SpaceInsideStringInterpolation: 216 | Enabled: true 217 | Layout/TrailingEmptyLines: 218 | Enabled: true 219 | Layout/FirstHashElementIndentation: 220 | Enabled: true 221 | EnforcedStyle: consistent 222 | Exclude: # To handle cases in `let` blocks in tests 223 | - '**/spec/**/*' 224 | - '**/test/**/*' 225 | Layout/FirstArrayElementIndentation: 226 | Enabled: true 227 | EnforcedStyle: consistent 228 | Exclude: # To handle cases in `let` blocks in tests 229 | - '**/spec/**/*' 230 | - '**/test/**/*' 231 | 232 | Lint/AmbiguousAssignment: 233 | Enabled: true 234 | Lint/AssignmentInCondition: 235 | Enabled: true 236 | Lint/BinaryOperatorWithIdenticalOperands: 237 | Enabled: true 238 | Lint/CircularArgumentReference: 239 | Enabled: true 240 | Lint/ConstantDefinitionInBlock: 241 | Enabled: true 242 | Lint/DeprecatedClassMethods: 243 | Enabled: true 244 | Lint/DeprecatedConstants: 245 | Enabled: true 246 | Lint/DisjunctiveAssignmentInConstructor: 247 | Enabled: true 248 | Lint/DuplicateElsifCondition: 249 | Enabled: true 250 | Lint/DuplicateHashKey: 251 | Enabled: true 252 | Lint/DuplicateMethods: 253 | Enabled: true 254 | Lint/DuplicateRequire: 255 | Enabled: true 256 | Lint/ElseLayout: 257 | Enabled: true 258 | Lint/FloatComparison: 259 | Enabled: true 260 | Lint/FloatOutOfRange: 261 | Enabled: true 262 | Lint/IneffectiveAccessModifier: 263 | Enabled: true 264 | Lint/InterpolationCheck: 265 | Enabled: true 266 | Lint/LiteralAsCondition: 267 | Enabled: true 268 | Lint/LiteralInInterpolation: 269 | Enabled: true 270 | Lint/MissingCopEnableDirective: 271 | Enabled: true 272 | Lint/MultipleComparison: 273 | Enabled: true 274 | Lint/NestedMethodDefinition: 275 | Enabled: true 276 | Lint/OrAssignmentToConstant: 277 | Enabled: true 278 | Lint/RandOne: 279 | Enabled: true 280 | Lint/RedundantStringCoercion: 281 | Enabled: true 282 | Lint/RedundantWithIndex: 283 | Enabled: true 284 | Lint/RequireParentheses: 285 | Enabled: true 286 | Lint/ReturnInVoidContext: 287 | Enabled: true 288 | Lint/SelfAssignment: 289 | Enabled: true 290 | Lint/SymbolConversion: 291 | Enabled: true 292 | Lint/Syntax: 293 | Enabled: true 294 | Lint/TopLevelReturnWithArgument: 295 | Enabled: true 296 | Lint/TrailingCommaInAttributeDeclaration: 297 | Enabled: true 298 | Lint/TripleQuotes: 299 | Enabled: true 300 | Lint/UnderscorePrefixedVariableName: 301 | Enabled: true 302 | Lint/UnreachableCode: 303 | Enabled: true 304 | Lint/UnreachableLoop: 305 | Enabled: true 306 | Lint/UnusedBlockArgument: 307 | Enabled: true 308 | Lint/UnusedMethodArgument: 309 | Enabled: true 310 | Lint/UselessAccessModifier: 311 | Enabled: true 312 | Lint/Void: 313 | Enabled: true 314 | 315 | Naming/AccessorMethodName: 316 | Enabled: true 317 | Naming/AsciiIdentifiers: 318 | Enabled: true 319 | Naming/BinaryOperatorParameterName: 320 | Enabled: true 321 | Naming/ClassAndModuleCamelCase: 322 | Enabled: true 323 | Naming/ConstantName: 324 | Enabled: true 325 | Naming/FileName: 326 | Enabled: true 327 | Naming/InclusiveLanguage: 328 | Enabled: true 329 | Naming/MethodName: 330 | Enabled: true 331 | Naming/PredicateName: 332 | Enabled: true 333 | Naming/VariableName: 334 | Enabled: true 335 | Naming/VariableNumber: 336 | Enabled: true 337 | 338 | Style/CollectionCompact: 339 | Enabled: true 340 | Style/EvenOdd: 341 | Enabled: true 342 | Style/GuardClause: 343 | Enabled: true 344 | Style/HashEachMethods: 345 | Enabled: true 346 | Style/HashExcept: 347 | Enabled: true 348 | Style/IfInsideElse: 349 | Enabled: true 350 | AllowIfModifier: true 351 | Style/IfWithBooleanLiteralBranches: 352 | Enabled: true 353 | Style/InverseMethods: 354 | Enabled: true 355 | Style/KeywordParametersOrder: 356 | Enabled: true 357 | Style/MethodDefParentheses: 358 | Enabled: true 359 | Style/MinMax: 360 | Enabled: true 361 | Style/MultilineIfThen: 362 | Enabled: true 363 | Style/MutableConstant: 364 | Enabled: true 365 | Style/NegatedIf: 366 | Enabled: true 367 | Style/NegatedIfElseCondition: 368 | Enabled: true 369 | Style/NegatedUnless: 370 | Enabled: true 371 | Style/NegatedWhile: 372 | Enabled: true 373 | Style/NestedModifier: 374 | Enabled: true 375 | Style/NestedTernaryOperator: 376 | Enabled: true 377 | Style/NilComparison: 378 | Enabled: true 379 | Style/NumericLiteralPrefix: 380 | Enabled: true 381 | Style/Not: 382 | Enabled: true 383 | Style/NumericLiterals: 384 | Enabled: true 385 | Style/NumericPredicate: 386 | Enabled: true 387 | Style/OneLineConditional: 388 | Enabled: true 389 | Style/OptionHash: 390 | Enabled: true 391 | Style/OptionalArguments: 392 | Enabled: true 393 | Style/OrAssignment: 394 | Enabled: true 395 | Style/RandomWithOffset: 396 | Enabled: true 397 | Style/RedundantArgument: 398 | Enabled: true 399 | Style/RedundantAssignment: 400 | Enabled: true 401 | Style/RedundantCondition: 402 | Enabled: true 403 | Style/RedundantConditional: 404 | Enabled: true 405 | Style/RedundantFileExtensionInRequire: 406 | Enabled: true 407 | Style/RedundantFreeze: 408 | Enabled: true 409 | Style/RedundantInterpolation: 410 | Enabled: true 411 | Style/RedundantParentheses: 412 | Enabled: true 413 | Style/RedundantSelf: 414 | Enabled: true 415 | Style/RedundantSelfAssignment: 416 | Enabled: true 417 | Style/RedundantSelfAssignmentBranch: 418 | Enabled: true 419 | Style/RedundantSort: 420 | Enabled: true 421 | Style/RedundantSortBy: 422 | Enabled: true 423 | Style/SafeNavigation: 424 | Enabled: true 425 | Style/Sample: 426 | Enabled: true 427 | Style/Send: # Devs often use `#send` to call private methods - not good! 428 | Enabled: true 429 | Style/SlicingWithRange: 430 | Enabled: true 431 | Style/SoleNestedConditional: 432 | Enabled: true 433 | Style/StringChars: 434 | Enabled: true 435 | Style/TrailingMethodEndStatement: 436 | Enabled: true 437 | Style/TrailingBodyOnMethodDefinition: 438 | Enabled: true 439 | Style/TrailingBodyOnClass: 440 | Enabled: true 441 | Style/TrivialAccessors: 442 | Enabled: true 443 | Style/UnlessElse: 444 | Enabled: true 445 | Style/VariableInterpolation: 446 | Enabled: true 447 | Style/YodaCondition: 448 | Enabled: true 449 | Style/ZeroLengthPredicate: 450 | Enabled: true 451 | Style/DefWithParentheses: 452 | Enabled: true 453 | Style/IdenticalConditionalBranches: 454 | Enabled: true 455 | Style/SelfAssignment: 456 | Enabled: true 457 | Style/SymbolLiteral: 458 | Enabled: true 459 | Style/BlockDelimiters: 460 | Enabled: true 461 | Exclude: # `let` blocks are commonly multiline in tests 462 | - '**/spec/**/*' 463 | - '**/test/**/*' 464 | --------------------------------------------------------------------------------