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

Fix an error when running --only or --except options #7905

Merged

Commits on Apr 24, 2020

  1. Fix an error when running --only or --except options

    This PR fixes an error when running `rubocop --only` or
    `rubocop --except` options without cop name argument.
    
    ## Before
    
    ```consle
    % rubocop --only
    undefined method `empty?' for nil:NilClass
    /Users/koic/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.82.0/lib/rubocop/options.rb:87:in
    `block in add_cop_selection_csv_option'
    /Users/koic/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.82.0/lib/rubocop/options.rb:206:in
    `block in option'
    /Users/koic/.rbenv/versions/2.7.1/lib/ruby/2.7.0/optparse.rb:1589:in
    `block in parse_in_order'
    /Users/koic/.rbenv/versions/2.7.1/lib/ruby/2.7.0/optparse.rb:1575:in `catch'
    ```
    
    ## After
    
    ```console
    % rubocop --only
    --only argument should be [COP1,COP2,...].
    ```
    
    The same is true for `rubocop --except`.
    koic committed Apr 24, 2020
    Copy the full SHA
    7051a44 View commit details
    Browse the repository at this point in the history