Andrew Grimm Andrew Grimm - 6 months ago 19
Ruby Question

Equivalent of --fail-level for haml-lint

RuboCop has the

--fail-level
configuration option:


--fail-level

Minimum severity for exit with error code. Full severity name or
upper case initial can be given. Normally, auto-corrected offenses are
ignored. Use A or autocorrect if you'd like them to trigger failure.


Is there an equivalent of that for haml-lint, so that even if a file has warnings, the haml-lint program returns success, so it can be used in CI?

Haml-lint has severity levels:


severity

The severity of the linter. External tools consuming haml-lint output
can use this to determine whether to warn or error based on the lints
reported.


but no sign of a
--fail-level
.

Answer

As a workaround, if you only want to test for an Error, choose a single linter that's unlikely to fail:

bundle exec haml-lint --include-linter ClassAttributeWithStaticValue app/views/