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
feat(tactic/lint): support @[nolint unused_arguments] #2041
Conversation
Could you update docs/commands.md? |
Should it even be the default that |
This behavior is not the "least surprising". If we want to force users to specify disabled linters explicitly, then |
I think I introduced a performance issue when refactoring the linting code. The linters now take 30 minutes instead of 12. I'm debugging it now.
Done.
I agree. The only reason it did not fail was because of the |
The performance issue was due to using user attributes with parameters. I'm using the obvious fix now: /--
Computes the declaration name used to store the nolint attribute data.
Retrieving the parameters for user attributes is *extremely* slow.
Hence we store the parameters of the nolint attribute as declarations
in the environment. E.g. for `@[nolint foo] def bar := _` we add the
following declaration:
meta def bar._nolint.foo : unit := ()
-/
private meta def mk_nolint_decl_name (decl : name) (linter : name) : name :=
(decl ++ nolint_infix) ++ linter As requested, -- data/dfinsupp.lean
apply_nolint decidable_zero_symm doc_blame
apply_nolint dfinsupp doc_blame
apply_nolint dfinsupp.decidable_eq unused_arguments
apply_nolint dfinsupp.erase doc_blame
apply_nolint dfinsupp.lmk doc_blame
apply_nolint dfinsupp.lsingle doc_blame
apply_nolint dfinsupp.map_range_def unused_arguments
apply_nolint dfinsupp.map_range_single unused_arguments
apply_nolint dfinsupp.mk doc_blame
apply_nolint dfinsupp.pre doc_blame has_inhabited_instance
apply_nolint dfinsupp.single doc_blame
apply_nolint dfinsupp.subtype_domain_sum unused_arguments
apply_nolint dfinsupp.sum_apply unused_arguments
apply_nolint dfinsupp.support doc_blame
apply_nolint dfinsupp.to_has_scalar doc_blame
apply_nolint dfinsupp.to_module doc_blame
apply_nolint dfinsupp.zip_with doc_blame
apply_nolint dfinsupp.zip_with_def unused_arguments
-- data/dlist/basic.lean
apply_nolint dlist.join doc_blame |
src/category/functor.lean
Outdated
@@ -42,7 +42,8 @@ def id.mk {α : Sort u} : α → id α := id | |||
|
|||
namespace functor | |||
|
|||
@[nolint] def const (α : Type*) (β : Type*) := α | |||
@[nolint unused_arguments doc_blame] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@[nolint doc_blame]
is saying this def is permanently allowed to not have a doc string. Could you either add a doc string, or add it to nolints.txt
(temporary permission to not have a doc string)? Same for map
below. The examples in ordinal
are a little different since morally they're lemmas, not defs.
I'd suggest a doc string but honestly I'm not sure what this is for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I've added a docstring for const
, but the rest of the file is a bit of a mystery to me as well. I've got no idea what add_const
is for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe @cipher1024 could help here.
…munity#2041) * feat(tactic/lint): support @[nolint unused_arguments] * refactor(scripts/mk_nolint): include failing linter name in nolints.txt * chore(scripts/nolints): update nolints.txt * doc(category/functor): add docstrings Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…munity#2041) * feat(tactic/lint): support @[nolint unused_arguments] * refactor(scripts/mk_nolint): include failing linter name in nolints.txt * chore(scripts/nolints): update nolints.txt * doc(category/functor): add docstrings Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
We have so many linters now and
@[nolint]
disables all of them. This PR adds parameters to thenolint
attribute so that you can selectively disable some lints only:TO CONTRIBUTORS:
Make sure you have:
If this PR is related to a discussion on Zulip, please include a link in the discussion.
For reviewers: code review check list