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

Add new Lint/ItWithoutArgumentsInBlock cop #12518

Merged

Commits on Dec 7, 2023

  1. Add new Lint/ItWithoutArgumentsInBlock cop

    Follow up https://bugs.ruby-lang.org/issues/18980 and ruby/ruby#9152.
    
    Emulates the following Ruby warnings in Ruby 3.3.
    
    ```ruby
    $ ruby -e '0.times { it }'
    -e:1: warning: `it` calls without arguments will refer to the first block param in Ruby 3.4;
    use it() or self.it
    ```
    
    `it` calls without arguments will refer to the first block param in Ruby 3.4.
    So use `it()` or `self.it` to ensure compatibility.
    
    ```ruby
    # bad
    do_something { it }
    
    # good
    do_something { it() }
    do_something { self.it }
    ```
    koic committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    4c1884b View commit details
    Browse the repository at this point in the history