Skip to content
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

Enforce numblock verification for ALL the cops that check block nodes #10915

Merged
merged 47 commits into from Aug 12, 2022

Commits on Aug 12, 2022

  1. Copy the full SHA
    1971dfa View commit details
    Browse the repository at this point in the history
  2. Introduce InternalAffairs/NumblockHandler

    The `InternalAffairs/NumblockHandler` ensures cops that handle `block`
    nodes will also handle `numblock` nodes or disable it explicitly. We
    have exceptions for this check like cops that check block parameters but
    for the majority of the cases we want `numblock` nodes to handled.
    gsamokovarov committed Aug 12, 2022
    Copy the full SHA
    b214a06 View commit details
    Browse the repository at this point in the history
  3. Disable InternalAffairs/NumbockHandler for block cops

    While, technically, we can use gemspec definitions like:
    
    ```
    Gem::Specification.new do
      _1.metadata['rubygems_mfa_required'] = 'true'
    end
    ```
    gsamokovarov committed Aug 12, 2022
    Copy the full SHA
    ec1739d View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    1cf4f08 View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    462955c View commit details
    Browse the repository at this point in the history
  6. Copy the full SHA
    fef71ab View commit details
    Browse the repository at this point in the history
  7. Copy the full SHA
    5425fd8 View commit details
    Browse the repository at this point in the history
  8. Copy the full SHA
    e8afc00 View commit details
    Browse the repository at this point in the history
  9. Copy the full SHA
    37ef3de View commit details
    Browse the repository at this point in the history
  10. Copy the full SHA
    71776fc View commit details
    Browse the repository at this point in the history
  11. Copy the full SHA
    45dc712 View commit details
    Browse the repository at this point in the history
  12. Copy the full SHA
    9a3f41f View commit details
    Browse the repository at this point in the history
  13. Copy the full SHA
    b5d452c View commit details
    Browse the repository at this point in the history
  14. Disable InternalAffairs/NumblockHandler for HashTransformMethod

    This mixin (`HashTransformMethod`) holds implementation details for the
    cops Style/HashTransformKeys and Style/HashTransformValues. Their usage
    is based on named block arguments and destructuring, which is not how
    one would use numbered arguments. I'll delay (avoid) this implementation.
    gsamokovarov committed Aug 12, 2022
    Copy the full SHA
    3b8b65d View commit details
    Browse the repository at this point in the history
  15. Copy the full SHA
    fff6f47 View commit details
    Browse the repository at this point in the history
  16. Copy the full SHA
    3fea156 View commit details
    Browse the repository at this point in the history
  17. Copy the full SHA
    9297084 View commit details
    Browse the repository at this point in the history
  18. Copy the full SHA
    413cc86 View commit details
    Browse the repository at this point in the history
  19. Copy the full SHA
    8010fb4 View commit details
    Browse the repository at this point in the history
  20. Copy the full SHA
    69b6400 View commit details
    Browse the repository at this point in the history
  21. Fix Layout/LineLength with numblocks

    While applying the cop to `numbock`s, I have found a bug with regular
    `block` nodes and singe-line do-end blocks without arguments.
    
    This got autocorrected to...
    
    ```ruby
    foo.select do 4444000039123123129993912312312999199291203123 end
    ```
    
    ... that 👇
    
    ```ruby
    foo.select d
    o 4444000039123123129993912312312999199291203123 end
    ```
    
    This is not valid Ruby code, so I fixed that while at it.
    gsamokovarov committed Aug 12, 2022
    Copy the full SHA
    d4ad9bc View commit details
    Browse the repository at this point in the history
  22. Copy the full SHA
    39d2ffc View commit details
    Browse the repository at this point in the history
  23. Copy the full SHA
    9d90591 View commit details
    Browse the repository at this point in the history
  24. Copy the full SHA
    e707f3b View commit details
    Browse the repository at this point in the history
  25. Copy the full SHA
    911de36 View commit details
    Browse the repository at this point in the history
  26. Copy the full SHA
    58a6577 View commit details
    Browse the repository at this point in the history
  27. Copy the full SHA
    198047b View commit details
    Browse the repository at this point in the history
  28. Copy the full SHA
    bff739a View commit details
    Browse the repository at this point in the history
  29. Copy the full SHA
    8cb4af9 View commit details
    Browse the repository at this point in the history
  30. Copy the full SHA
    92cbae5 View commit details
    Browse the repository at this point in the history
  31. Fix Metrics{AbcSize,CyclomaticComplexity} with numblocks

    Both of them use `MethodComplexity` which now supports `define_method`
    with numblocks.
    gsamokovarov committed Aug 12, 2022
    Copy the full SHA
    494424c View commit details
    Browse the repository at this point in the history
  32. Copy the full SHA
    d5dd796 View commit details
    Browse the repository at this point in the history
  33. Copy the full SHA
    6e67b89 View commit details
    Browse the repository at this point in the history
  34. Fix Style/For with numblocks

    The autocorrect can and will generate broken code when using numbered
    arguments as `_1` is not a valid local variable name outside numblocks.
    gsamokovarov committed Aug 12, 2022
    Copy the full SHA
    b9555f6 View commit details
    Browse the repository at this point in the history
  35. Copy the full SHA
    a136188 View commit details
    Browse the repository at this point in the history
  36. Copy the full SHA
    a049d32 View commit details
    Browse the repository at this point in the history
  37. Copy the full SHA
    33d5d21 View commit details
    Browse the repository at this point in the history
  38. Copy the full SHA
    254564b View commit details
    Browse the repository at this point in the history
  39. Copy the full SHA
    be532af View commit details
    Browse the repository at this point in the history
  40. Copy the full SHA
    88c78bd View commit details
    Browse the repository at this point in the history
  41. Copy the full SHA
    bdb1db9 View commit details
    Browse the repository at this point in the history
  42. Copy the full SHA
    381c2b8 View commit details
    Browse the repository at this point in the history
  43. Copy the full SHA
    c55de18 View commit details
    Browse the repository at this point in the history
  44. Copy the full SHA
    ba93975 View commit details
    Browse the repository at this point in the history
  45. Fix Style/EachWithObject with numblocks

    The autocorrection does not remove the return value in
    `each_with_object`, but the numbered arguments are swapped. Not the best
    autocorrection, but it is still correct as `each_with_object` ignores
    the return value of its block.
    gsamokovarov committed Aug 12, 2022
    Copy the full SHA
    78532ed View commit details
    Browse the repository at this point in the history
  46. Copy the full SHA
    abb950d View commit details
    Browse the repository at this point in the history
  47. Copy the full SHA
    e63c32f View commit details
    Browse the repository at this point in the history