-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Invalid config file silently ignored #5313
Comments
You could argure that one should run |
Ignoring invalid elements is a choice: it allows to not break with deprecated and removed elements. Most IDEs are connected to the JSONSchema store and can validate the configuration. |
@ldez would it be possible to add an option for strict config parsing? |
I don't want to do that for different reasons, one is related to the work on v2 and the kind of option will be a problem for the migration. We already have a command to verify the configuration and most of the IDEs check the JSONSchema automatically. FYI, your PR will never work as you think because we hacked the configuration parsing, it will just break the parsing of some elements. |
@ldez may I at least document this behavior somewhere? Either here, or in gh action repo? |
Interestingly, not that many people do that: I wonder, out of tens of thousands of config files, how many are silently ignored because of a typo... |
I will not participate in this sterile discussion: I was clear about the topic. You can disagree, and we can agree to disagree. |
@ldez If you are open to documentation update, I will submit one. |
Before this message and this one, I was open to thinking about a place inside the doc. Added to the fact that you ping me on every message, now, I'm just upset, so I will keep your suggestion for later. |
I do not have an idea that you considered tagging a rude thing. Ok, let me know if you think it should be documented at least somewhere... Another point is: if there is an empty .golanci.yml config file somewhere along the search path(described at https://golangci-lint.run/usage/configuration/#config-file), that empty file will be used. Probably not users would expect too. |
To add to the context and give an example about why invalid config can be useful, gclv optionally uses the configuration file to pin version of |
Welcome
typecheck
section of the FAQ.Description of the problem
If golangci-lint found a config file, but the file is invalid, it still runs...
Version of golangci-lint
Configuration
https://github.com/golangci/golangci-lint/blob/master/.golangci.yml
Go environment
Verbose output of running
See below
A minimal reproducible example or link to a public repository
But we ignore it and fall back to the default config(?), run 6 linters, and still exit with code 0.
I feel like this behavior violates https://en.wikipedia.org/wiki/Principle_of_least_astonishment.
Clearly, since the config file is found, the user wanted it to be there and to be used, but messed up.
We should let the user know about it, probably by exiting non-zero, so it won't be silently ignored in ci.
Validation
Supporter
The text was updated successfully, but these errors were encountered: