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 support for applying rules only in particular range of a specific file. #270

Open
ketkarameya opened this issue Nov 16, 2022 · 1 comment
Assignees

Comments

@ketkarameya
Copy link
Collaborator

ketkarameya commented Nov 16, 2022

Include/Exclude specific (patterns) of files

@dvmarcilio
Copy link
Collaborator

As context, specifying a particular range in a file for a rule could be helpful when there are duplicated nodes.
More specifically, a seemingly common pattern in Go is to keep assigning an error to the same identifier.

Currently, there is no easy way to clean up the error handling if statement for the call with enabledFlag in the snippet below.
Matching err != nil would also wrongly match the second if statement.
Providing a line numbers range could be a way to handle cases like this correctly.

enabled, err := exp.BoolValue("enabledFlag")
if err != nil {
    // ...
}

disabled, err := exp.BoolValue("disabledFlag")
if err != nil {
    // ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants