-
Notifications
You must be signed in to change notification settings - Fork 50
Enable cops in the Lint Department #694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2f2175b
to
332a6ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These all look super reasonable to me, I think you've made good decisions here.
332a6ca
to
3106a1a
Compare
The following Lint cops were enabled: * [Lint/AmbiguousAssignment](https://docs.rubocop.org/rubocop/cops_lint.html#lintambiguousassignment) * [Lint/AmbiguousOperator](https://docs.rubocop.org/rubocop/cops_lint.html#lintambiguousoperator) * [Lint/BigDecimalNew](https://docs.rubocop.org/rubocop/cops_lint.html#lintbigdecimalnew) * [Lint/BinaryOperatorWithIdenticalOperands](https://docs.rubocop.org/rubocop/cops_lint.html#lintbinaryoperatorwithidenticaloperands) * [Lint/CircularArgumentReference](https://docs.rubocop.org/rubocop/cops_lint.html#lintcircularargumentreference) * [Lint/ConstantOverwrittenInRescue](https://docs.rubocop.org/rubocop/cops_lint.html#lintconstantoverwritteninrescue) * [Lint/ConstantReassignment](https://docs.rubocop.org/rubocop/cops_lint.html#lintconstantreassignment) * [Lint/CopDirectiveSyntax](https://docs.rubocop.org/rubocop/cops_lint.html#lintcopdirectivesyntax) * [Lint/Debugger](https://docs.rubocop.org/rubocop/cops_lint.html#lintdebugger) * [Lint/DeprecatedClassMethods](https://docs.rubocop.org/rubocop/cops_lint.html#lintdeprecatedclassmethods) * [Lint/DeprecatedOpenSSLConstant](https://docs.rubocop.org/rubocop/cops_lint.html#lintdeprecatedopensslconstant) * [Lint/DisjunctiveAssignmentInConstructor](https://docs.rubocop.org/rubocop/cops_lint.html#lintdisjunctiveassignmentinconstructor) * [Lint/DuplicateCaseCondition](https://docs.rubocop.org/rubocop/cops_lint.html#lintduplicatecasecondition) * [Lint/DuplicateElsifCondition](https://docs.rubocop.org/rubocop/cops_lint.html#lintduplicateelsifcondition) * [Lint/DuplicateHashKey](https://docs.rubocop.org/rubocop/cops_lint.html#lintduplicatehashkey) * [Lint/DuplicateMagicComment](https://docs.rubocop.org/rubocop/cops_lint.html#lintduplicatemagiccomment) * [Lint/DuplicateMatchPattern](https://docs.rubocop.org/rubocop/cops_lint.html#lintduplicatematchpattern) * [Lint/DuplicateMethods](https://docs.rubocop.org/rubocop/cops_lint.html#lintduplicatemethods) * [Lint/DuplicateRegexpCharacterClassElement](https://docs.rubocop.org/rubocop/cops_lint.html#lintduplicateregexpcharacterclasselement) * [Lint/DuplicateRequire](https://docs.rubocop.org/rubocop/cops_lint.html#lintduplicaterequire) * [Lint/DuplicateRescueException](https://docs.rubocop.org/rubocop/cops_lint.html#lintduplicaterescueexception) * [Lint/DuplicateSetElement](https://docs.rubocop.org/rubocop/cops_lint.html#lintduplicatesetelement) * [Lint/EachWithObjectArgument](https://docs.rubocop.org/rubocop/cops_lint.html#linteachwithobjectargument) * [Lint/ElseLayout](https://docs.rubocop.org/rubocop/cops_lint.html#lintelselayout) * [Lint/EmptyEnsure](https://docs.rubocop.org/rubocop/cops_lint.html#lintemptyensure) * [Lint/EmptyExpression](https://docs.rubocop.org/rubocop/cops_lint.html#lintemptyexpression) * [Lint/EmptyInterpolation](https://docs.rubocop.org/rubocop/cops_lint.html#lintemptyinterpolation) * [Lint/EnsureReturn](https://docs.rubocop.org/rubocop/cops_lint.html#lintensurereturn) * [Lint/ImplicitStringConcatenation](https://docs.rubocop.org/rubocop/cops_lint.html#lintimplicitstringconcatenation) * [Lint/IneffectiveAccessModifier](https://docs.rubocop.org/rubocop/cops_lint.html#lintineffectiveaccessmodifier) * [Lint/InterpolationCheck](https://docs.rubocop.org/rubocop/cops_lint.html#lintinterpolationcheck) * [Lint/LiteralAsCondition](https://docs.rubocop.org/rubocop/cops_lint.html#lintliteralascondition) * [Lint/LiteralInInterpolation](https://docs.rubocop.org/rubocop/cops_lint.html#lintliteralininterpolation) * [Lint/MissingCopEnableDirective](https://docs.rubocop.org/rubocop/cops_lint.html#lintmissingcopenabledirective) * [Lint/MixedCaseRange](https://docs.rubocop.org/rubocop/cops_lint.html#lintmixedcaserange) * [Lint/MultipleComparison](https://docs.rubocop.org/rubocop/cops_lint.html#lintmultiplecomparison) * [Lint/NestedMethodDefinition](https://docs.rubocop.org/rubocop/cops_lint.html#lintnestedmethoddefinition) * [Lint/NestedPercentLiteral](https://docs.rubocop.org/rubocop/cops_lint.html#lintnestedpercentliteral) * [Lint/NextWithoutAccumulator](https://docs.rubocop.org/rubocop/cops_lint.html#lintnextwithoutaccumulator) * [Lint/NoReturnInBeginEndBlocks](https://docs.rubocop.org/rubocop/cops_lint.html#lintnoreturnInbeginendblocks) * [Lint/NumericOperationWithConstantResult](https://docs.rubocop.org/rubocop/cops_lint.html#lintnumericoperationwithconstantresult) * [Lint/OrAssignmentToConstant](https://docs.rubocop.org/rubocop/cops_lint.html#lintoreassignmenttoconstant) * [Lint/ParenthesesAsGroupedExpression](https://docs.rubocop.org/rubocop/cops_lint.html#lintparenthesesasgroupedexpression) * [Lint/RedundantCopDisableDirective](https://docs.rubocop.org/rubocop/cops_lint.html#lintredundantcopdisabledirective) * [Lint/RedundantCopEnableDirective](https://docs.rubocop.org/rubocop/cops_lint.html#lintredundantcopenabledirective) * [Lint/RedundantStringCoercion](https://docs.rubocop.org/rubocop/cops_lint.html#lintredundantstringcoercion) * [Lint/RedundantWithIndex](https://docs.rubocop.org/rubocop/cops_lint.html#lintredundantwithindex) * [Lint/RedundantWithObject](https://docs.rubocop.org/rubocop/cops_lint.html#lintredundantwithobject) * [Lint/RegexpAsCondition](https://docs.rubocop.org/rubocop/cops_lint.html#lintregexpascondition) * [Lint/ReturnInVoidContext](https://docs.rubocop.org/rubocop/cops_lint.html#lintreturninvoidcontext) * [Lint/SelfAssignment](https://docs.rubocop.org/rubocop/cops_lint.html#lintselfassignment) * [Lint/SendWithMixinArgument](https://docs.rubocop.org/rubocop/cops_lint.html#lintsendwithmixinargument) * [Lint/TripleQuotes](https://docs.rubocop.org/rubocop/cops_lint.html#linttriplequotes)
3106a1a
to
3dbbdfe
Compare
This cop checks for the use of `return` with a value in `begin..end` blocks in the context of instance variable assignment such as memoization. Using `return` with a value in these blocks can lead to unexpected behavior as the `return` will exit the method and not set the value of the instance variable.
We only support Rubocop 1.72.
Now we have Lint/NoReturnInMemoization cop that should replace this one.
Make explicit that this is going to be a major version bump.
Add Lint/NoReturnInMemoization cop
Should we also re-enable Lint/SafeNavigationChain? It would have caught a bug that just slipped to prod (luckily behind a flag that could be immediately rolled back.) Ruby's safe-navigation behavior is inconsistent with Typescript's optional chaining, which can be a footgun for a lot of devs. // in typescript
foo?.bar.baz()
// is equivalent to
foo === null || foo === undefined
? undefined
: foo.bar.baz() # in ruby
foo&.bar.baz
# is equivalent to
(foo == nil ? nil : foo.bar).baz # NoMethodError: undefined method `baz' for nil:NilClass |
Yes. I'm wondering how did I forgot about it. |
The following Lint cops were enabled: