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 Style/EmptyHeredoc cop #10820

Merged
merged 1 commit into from Jul 18, 2022

Commits on Jul 17, 2022

  1. Add new Style/EmptyHeredoc cop

    ## Summary
    
    Checks for using empty heredoc to reduce redundancy.
    
    ```ruby
    # bad
    <<~EOS
    EOS
    
    <<-EOS
    EOS
    
    <<EOS
    EOS
    
    # good
    ''
    
    # bad
    do_something(<<~EOS)
    EOS
    
    do_something(<<-EOS)
    EOS
    
    do_something(<<EOS)
    EOS
    
    # good
    do_something('')
    ```
    
    ## Other Information
    
    I noticed the following redundancy in the RuboCop test code:
    
    ```ruby
    expect_correction(<<~RUBY)
    RUBY
    ```
    
    This cop solves it generically.
    koic committed Jul 17, 2022
    Copy the full SHA
    b3ba8a3 View commit details
    Browse the repository at this point in the history