Follow up bikeshed: should `regex-lint` be activat...
# development
h
Follow up bikeshed: should
regex-lint
be activated by default or you have to add a backend for it?
Right now, I have it activated by default, but you have to set
[regex-lint].config
for it to work. The issue is that it causes this annoying output with
lint
Copy code
āœ“ autoflake succeeded.
āœ“ isort succeeded.
- regex-lint skipped.
That is easily solved if you have to activate the backend instead
This isn't a problem with target-aware backends because they use
FieldSet.is_applicable()
in
core/goals/lint.py
to proactively determine whether the tool should run or not. I don't think that's feasible here because we need to access a subsystem to determine if
regex-lint
is activated or not, which requires using the Rules API. Compared to
FieldSet.is_applicable()
just using the Target API and plain-and-simple Python functions - no engine magic
Related, I have no idea where we should document this functionality. We never have really mentioned it bin docs before
w
ā€¦a backend might be reasonable. all the other linters work that way, and the docsite has better facilities for it now.
šŸ‘ 2
p
I would expect to enable a backend before using it.
šŸ‘ 1
h
Any suggestions for what backend
regex-lint
should live in...(A Pants-provided linter where you define regexes and Pants checks them, e.g. for copyright compliance) All I can think of ā€¢
pants.backend.lint.regex_lint
ā€¢
pants.backend.utils.regex_lint
c
Does it need its own backend, rather than live in pants.core? (Meaning, being registered by core, could have the implementation elsewhere..)
h
Yeah, that's the top of this thread. Otherwise we don't have a way to know that the plugin should be disabled, and the summary will claim
regex-lint
was skipped, which is noisy. I could hack around it by adding a boolean toggle to
LintResults
like
disabled=True
...That's a code smell, but it's possible. Wdyt?
Actually, maybe it's useful to let plugins distinguish between disabled vs skipped...? The idea of skipped is when you set
--black-skip
to temporarily skip. Or, maybe it's not actual that useful to render in the summary skipped? If we stop doing that, this problem is solved.
Copy code
./pants --isort-skip fmt ::
āœ“ autoflake succeeded.
- isort skipped.
Here, we wouldn't show
isort
at all anymore. I think there's a minor risk that you set
[isort].skip = true
in
pants.toml
and don't realize why it's not running, but that fear is probably overblown...Thoughts?
c
Yeah, not listing skipped work makes sense to me. Perhaps a verbose option could enable it.. or just use ldebug to get all the details
ā¤ļø 1
šŸ™Œ 1
h
Excellent, thank you! I'm also adding
lint --only=<name>
right now šŸ˜Ž
šŸ™Œ 2
šŸ‘ 1