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

Linting - API #2149

Draft
wants to merge 17 commits into
base: feat/prepare-for-lint-take-2
Choose a base branch
from
Draft

Linting - API #2149

wants to merge 17 commits into from

Conversation

nedtwigg
Copy link
Member

Spotless is still primarily a formatter, not a linter. But when formatting fails, it's more flexible to model those failures as lints so that the formatting can continue. For example, issues like

are difficult to resolve with our current model, because the only channel we have to communicate with the user is "this is the formatted content". Now we have two channels: "this is the formatted content" and "these are the problems we had".

At this point, the purpose of these lints is just to do formatting better. They are an implementation detail. If people start submitting PRs for more linters, perhaps it will turn into something more. Who knows!

@nedtwigg nedtwigg marked this pull request as draft May 30, 2024 19:28
@nedtwigg nedtwigg changed the title Linting API (take 2) Linting - API Jun 4, 2024
}

public static Lint create(String code, String msg, int lineStart, int lineEnd) {
if (lineEnd < lineStart) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Given lineNumberFor, lineNumber=-1 could be given a specific semantic (e.g. somewhere_undefined).

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good call, it's probably a mistake to pretend that every Lint knows the range that it applies to.

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.

None yet

2 participants