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 utility methods for evaluating how long a suggestion can be based on the line limit/where it is located #569

Open
Luro02 opened this issue Jul 14, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Luro02
Copy link
Collaborator

Luro02 commented Jul 14, 2024

Description

There are some suggestions that are currently limited by some arbitrary number to prevent too short or too long things from being suggested.

For example one might introduce an "unnecessary" variable for a very long line like this:

var x = /* very large
           maybe even multiline
           expression */;
System.out.println(x);

Here it wouldn't be sensible to suggest the variable as unnecessary, because it does serve a purpose.

There are other lints who would benefit from this too. The LOOP_COULD_BE_FOR is another one, it doesn't make sense to have a for loop that must be split into multiple lines to fit into some line limit:

for (/* ... */;
     /* ... */;
     /* ... */) {
    // ...
}

For that a utility method would be nice to have. Depending on the nesting, the line limit will be different, so it makes sense to have a helper method doing this correctly.

@Luro02 Luro02 added the enhancement New feature or request label Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant