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

Ignore lines made long by cop directive comments #488

Merged
merged 1 commit into from
Jan 30, 2023

Conversation

sambostock
Copy link
Contributor

@sambostock sambostock commented Jan 26, 2023

This resets Layout/LineLength's IgnoreCopDirectives to its default - true .

Assuming a config of Max: 20, for example purposes, this would be an offense based on our current config:

const_get(something) # rubocop:disable Sorbet/ConstantsFromStrings                                                                                                                    
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

and the author would have to resort to the more verbose

# rubocop:disable Sorbet/ConstantsFromStrings 
const_get(something)                                                                                                                    
# rubocop:enable Sorbet/ConstantsFromStrings

We already allow test descriptions to be long. I argue a similar justification applies here and that the inline version is better.

There is another alternative

const_get(something) # rubocop:disable Sorbet/ConstantsFromStrings,Layout/LineLength

but that makes the line even longer than before, so I think it makes sense to just allow directives.

@sambostock sambostock requested a review from a team as a code owner January 26, 2023 20:32
@sambostock sambostock added the config change Changes the Rubocop config by enabling, disabling, or reconfiguring one or many cops label Jan 26, 2023
@sambostock sambostock merged commit 44bc7ce into main Jan 30, 2023
@sambostock sambostock deleted the allow-cop-directives-on-long-lines branch January 30, 2023 22:48
@shopify-shipit shopify-shipit bot temporarily deployed to rubygems April 11, 2023 15:04 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config change Changes the Rubocop config by enabling, disabling, or reconfiguring one or many cops
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants