Closed bittner closed 2 years ago
You can add arguments in .mega-linter.yml file :)
In your case, it would be PYTHON_BLACK_ARGUMENTS: ["--strict"]
Please reopen if my solution does not work :)
@nvuillam the --strict
option does not exists in black linter. It was just a suggestion by @bittner
@nvuillam Can you reopen the issue? It seems like I can't do that myself.
My point is: Black would actually error out, but the internal logic of Mega-Linter seems to qualify these (or some?) errors as "simply warnings". Is there is any switch to make Mega-Linter error out? If not, should we add one?
It seems like isort has a similar behavior. Likely because its interface, the one Mega-Linter uses, is very similar to Black. I would need this linter to fail our pipeline, too, on warnings.
MegaLinter fails when the return code is > 0, is there a way to make black return 1 or more in case of warnings ?
Black does exit with a status code != 0. That's what the --check
option does. The question is, how does Mega-Linter decide to identify this as a "warning"?
Linters defined as formatters in descriptors trigger a warning by default
You can change this behavior by defining FORMATTERS_DISABLE_ERRORS: false
:)
Nice, thank you! :1st_place_medal:
I'm using Black to lint Python code, and when it finds code it would reformat Mega-Linter identifies them as warnings. Hence the pipeline job succeeds.
According to Black's usage screen
black --diff --check
exits with a non-zero status code, hence I assume the command should fail.There doesn't seem to be any configuration switch to turn such warnings into errors (something like a
--strict
argument).Is this by design? Is there no way treat all warnings as errors, to avoid overlooking linter complaints?