rails_api_base icon indicating copy to clipboard operation
rails_api_base copied to clipboard

Check and change some of our current rubocop configuration

Open DJA89 opened this issue 1 year ago • 0 comments

Board:

Notion ticket


Description:

Checking the Rubocop rules we have set specific options to in our .rubocoop.yml


Notes:

List of changes or comments:

  • Layout/SpaceBeforeFirstArg: Removed exception and added AllowForAlignment so it works ok for how we use it on views.
  • Lint/BinaryOperatorWithIdenticalOperands: Removed, unlikely to be used but I only see positives as it removed redundancy.
  • Lint/DeprecatedOpenSSLConstant: Removed, it’s a deprecation warning, we shouldn’t use deprecated stuff if possible.
  • Lint/RaiseException: Removed, we shouldn’t raise plain Exceptions as catching them would mean catching every other kind of Exception in the same place.
  • Style/ArrayCoercion: Removed as it can cause problems https://github.com/rubocop/rubocop/issues/8783.
  • Rails/FilePath: Removed so it’s enabled, it’s good to always use the same syntax, the default is to use arguments but I’m fine if slashes are preferred.
  • Style/BlockDelimiters: Removed except on specs, it feels wrong to use braces on multi line blocks, if this is how most of the company uses it nowadays then we can change it but I believe it’s the other way around. Left it on specs because it is usually how they are used for expect { }.to even if it's multiline..
  • Style/ExpandPathArguments: I’m not really sure what difference this makes, never used it, might be good to have it turned on just to have consistency.
  • Style/GlobalStdStream: Same as above.
  • Style/HashEachMethods: Removed as it’s faster: https://stackoverflow.com/questions/46532459/what-is-the-difference-between-keys-each-and-each-key.
  • Style/HashTransformKeys: Removed as we have the necessary version of ruby and it looks way less confusing.
  • Style/HashTransformValues: Same as above.
  • Style/RedundantFetchBlock: Removed as it's faster https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/RedundantFetchBlock.
  • Style/RedundantFileExtensionInRequire: I’ve removed it since I’ve never seen us use require ‘something.rb’ explicitly.
  • Style/RedundantRegexpCharacterClass: Removed it as it only looks positive.
  • Style/ReturnNil: Do we usually return nil explicitly? Not used to this but not removing it as I’m not sure what most of us do.
  • Style/SlicingWithRange: Removing it as we have the necessary ruby version.
  • Style/StringConcatenation: I personally prefer interpolation, maybe using the conservative mode, wdpt? https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/StringConcatenation.

Tasks:

  • [x] Add each element in this format

Risk:


Preview:

DJA89 avatar Sep 13 '23 20:09 DJA89