8000 chore: constructorNameAsVariable linter respects linter.all by kim-em · Pull Request #4966 · leanprover/lean4 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

chore: constructorNameAsVariable linter respects linter.all #4966

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 1 commit into
base: master
Choose a base branch
from

Conversation

kim-em
Copy link
Collaborator
@kim-em kim-em commented Aug 9, 2024

@eric-wieser discovered while investigating a quote4 issue that linter.all doesn't disable constructorNameAsVariable.

This seems like an easy mistake to make when setting up a new linter, and perhaps we need a better structure to make it easy to do the right thing.

@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Aug 9, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 6dd502321f2b57a4b19c4b2a467ad900eeed8b91 --onto 647a5e94925791f6a16b629b6c16ffad60a7f478. (2024-08-09 01:15:32)

@kim-em
Copy link
Collaborator Author
kim-em commented Aug 9, 2024

Hmm, the test file works fine interactively, where linter.all is not set, but in CI the test file is run with linter.all false. I can't see how to test this properly without upstreaming unset_option from Mathlib.

@david-christiansen
Copy link
Contributor

Modulo the test issue, LGTM.

I agree about a better structure here, but I'm not sure what it should be - might as well fix the bug in the meantime.

Thanks!

@david-christiansen
Copy link
Contributor

I suppose for test purposes, it would work fine to inline the part of unset_option that does the job into just the test file here.

@@ -53,7 +58,7 @@ def constructorNameAsVariable : Linter where
if !cmdStxRange.contains range.start || ldecl.userName.hasMacroScopes then return
let opts := ci.options
-- we have to check for the option again here because it can be set locally
if !linter.constructorNameAsVariable.get opts then return
if !getLinterValue linter.constructorNameAsVariable opts then return
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason you use getLinterConstructorNameAsVariable at the top of the function but inline it here? I'd lean towards not having getLinterConstructorNameAsVariable at all, but if you really want it then it would be good to use consistently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0