Skip to content

Conversation

@thorimur
Copy link
Contributor

@thorimur thorimur commented Jan 5, 2026

This PR changes the behavior of runLinter --update. Previously, this would overwrite the nolints.json file with the full list of current linting violations, meaning that all declarations which violated linters were now nolinted.

However, it is intended to only "remove any declarations that no longer need
to be nolinted" (at least according to the docstring). This means that we should just filter out declarations from the nolints file which no longer fail (i.e., only include those from the nolints file which do still fail).

Since technically we run linters on individual modules, but the nolints.json file may apply to other modules besides the one being linted, we also only filter out those newly non-failing declarations which are from the current module and therefore are actually being linted.

This extra check can introduce some potential (benign) staleness in nolints.json if a nolinted declaration is removed (and thus never appears in any module, and so is never removed by --update). However, these ineffective nolints will not cause any problems, while overzealously deleting nolints from other modules might.

In the future, we might want to consider factoring out the --update behavior so that it is not part of runLinterOnModule, but instead occurs at the top level in main.


If possible, I'd like someone to verify that this is indeed the intended behavior of --update, and that it's not the case that the docstring is wrong. :)

@github-actions github-actions bot added the awaiting-review This PR is ready for review; the author thinks it is ready to be merged. label Jan 5, 2026
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Jan 5, 2026
@thorimur
Copy link
Contributor Author

thorimur commented Jan 5, 2026

WIP

@github-actions github-actions bot added WIP work in progress and removed awaiting-review This PR is ready for review; the author thinks it is ready to be merged. labels Jan 5, 2026
@thorimur
Copy link
Contributor Author

thorimur commented Jan 5, 2026

On zulip, it was mentioned that the current behavior for adding new violations to the nolint file is also useful (or possibly the primary use case!). (Note that the current behavior still needs a tweak because it overeagerly erases nolints that are not from the current module.)

I think both functionalities have a place; maybe --cleanup for this one?

@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. label Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds-mathlib merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. WIP work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants