-
Notifications
You must be signed in to change notification settings - Fork 38
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
Excluded files reported as unmatched #317
Comments
@jaen you can control the log level:
I've set the default to You can demote it to |
@brianmcgee I don't disagree that it can be useful, it's just that you might really want to ignore some files and then it becomes (at least lines relating to those files) noise. I have noticed the I think cache also doesn't quite solve the issue, unless you are expected to actually store the cache between CI runs? Because unless you do, the cache will be cold all the time in CI and you'll get the noise for those files all the time. Also, regarding CI I'd expect you might want CI to fail if some file was not covered with formatting/linting by accident, so you'd want to set Does it make any sense to you? |
I just re-read your description above, and I realise I completely missed the first point:
If it has been excluded, then it should not report it, but we don't properly account for this. |
Right, but writing my response above I realised it might not be as simple as just [formatter]
[formatter.language-lint-en]
command = "language-lint"
excludes = [ "docs/**" ]
includes = [ "**/*" ]
options = [ "--language", "en" ]
[formatter.language-lint-docs-en]
command = "language-lint"
excludes = [ "docs/en/**" ]
includes = [ "*.md" ]
options = [ "--language", "en" ]
[formatter.language-lint-docs-pl]
command = "language-lint"
excludes = [ "docs/pl/**" ]
includes = [ "*.md" ]
options = [ "--language", "pl" ] where you want to lint every file in your project in English (let's assume the tool If we just not report excluded files then — in case of this config — you won't get That's why I think it must be a bit more complex than just ignoring excludes. Two I'm not sure that global excludes being special would work well, as then you might As such, separating ignoring from inclusion/exclusions seems like a better option, |
Thanks for the detailed breakdown, I agree it's not so straightforward 🤔 I'll try and find some time in the next day or so to point my brain at this properly. |
Separates global excludes processing from `Formatter.Wants`. This removes redundant processing of global excludes in each `Formatter.Wants` call. If a file has been globally excluded, we do not emit an `on-unmatched` log message. This should help reduce as reported in #317. Signed-off-by: Brian McGee <[email protected]>
Separates global excludes processing from `Formatter.Wants`. This removes redundant processing of global excludes in each `Formatter.Wants` call. If a file has been globally excluded, we do not emit an `on-unmatched` log message. This should help reduce as reported in #317. Signed-off-by: Brian McGee <[email protected]>
Thanks! Adding a dummy |
It seems there might be a regression on this topic. In version 2.0.5 there are no warnings produced for files matched by the global excludes. But the warnings are back on current master. |
I'll have a look this week, just finishing docs changes first for main before lining up a release. Edit: created #468 to track it |
Describe the bug
When a file is explicitly excluded from linting, be it with a
global
or formatter-specific exclude, it gets reported when runningtreefmt
with ano formatter for path
. While it's certainly useful to know if you didn't cover some file by accident, you also might not want to format certain file (say, patches) and getting reminded about them in the output is superfluous noise.To Reproduce
Steps to reproduce the behavior:
WARN format: no formatter for path: some/excluded/file
in the output.Expected behavior
I would expect not being informed about files I don't plan to format. While it might make sense to warn by default for files that fall through the
includes
/excludes
filter — say, you format/lint different files of the same type differently for whatever reason (I dunno, typo checking for different languages in yourmd
-based docs), but you don't want any to be uncovered by accident — it also makes sense to never want to format certain files and not get nagged about them.I'm not sure what's the best solution here — maybe don't want about excludes coming from
global.excludes
or maybe have anglobal.ignores
config value — but anything would be welcome.System information
I used nixpkgs-unstable#treefmt2 which at this point in time points to 2.0.0-rc4.
The text was updated successfully, but these errors were encountered: