Skip to content

RemoveWildCardImports Lint issue #2571

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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

iddeepak
Copy link
Contributor

Thank you @Pankraz76. please feel free to use these changes
Original PR: #2557

@Pankraz76
Copy link
Contributor

nice one, thank you so much.

@iddeepak
Copy link
Contributor Author

Most of the work is already done by @Pankraz76. I updated Lint changes on top of it. kindly request your feedback.
@owaiskazi19
@sbrannen
@nedtwigg

@iddeepak iddeepak marked this pull request as ready for review July 22, 2025 18:12
@nedtwigg
Copy link
Member

This is close! It needs

  • ReplaceRegexStepTest which should be next to this
  • right now it can only catch the first problem. but it would be easy to catch all of them
    • in the format function, just return the input unchanged, don't throw
    • in the lint function, return multiple lints
    • public interface FormatterFunc {
      String apply(String input) throws Exception;
      default String apply(String unix, File file) throws Exception {
      return apply(unix);
      }
      /**
      * Calculates a list of lints against the given content.
      * By default, that's just an throwables thrown by the lint.
      */
      default List<Lint> lint(String content, File file) throws Exception {
      return List.of();
      }
    • the exception thing is a hack for a formatter which is primarily about formatting. if you are primarily about linting, better to use the other method

int line = 1 + (int) raw.codePoints().limit(matcher.start()).filter(c -> c == '\n').count();
lints.add(atLine(line, matcher.group(0), replacement));
}
return lints;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nedtwigg
spotless:apply for maven does not show lint errors ? for gradle it does.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aha! you are correct! i will try to fix that problem this week...

@@ -46,6 +46,8 @@
import com.diffplug.spotless.ResourceHarness;

public class MavenIntegrationHarness extends ResourceHarness {

protected static final String PATH = "src/main/java/test.java";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undo by inline. Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@iddeepak
Copy link
Contributor Author

#2455
In maven-plugin too

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

Successfully merging this pull request may close these issues.

3 participants