thibaudcolas / curlylint

Experimental HTML templates linting for Jinja, Nunjucks, Django templates, Twig, Liquid
https://www.curlylint.org/
MIT License
239 stars 25 forks source link

Provide an export format flag, or detect piping #20

Closed rixx closed 4 years ago

rixx commented 4 years ago

Is your proposal related to a problem?

Scrollback in terminals is often inconvenient, so I'm in a habit to pipe tool output into a temporary file. Introducing curlylint in a larger project can produce thousands of annotations!

But curlylint output always includes console colours, so the file reads like this:

6:4 Bad indentation, expected 8, got 4  indent
7:4 Bad indentation, expected 8, got 4  indent
14:0    Bad indentation, expected 4, got 0  indent

Describe the solution you’d like

Many tools either detect that their output is piped somewhere (which is a bit meh, I think) or provide a flag to force unformatted output. Down the line, different reporting formats might be a thing in any case, so maybe a flag like --report=plain, so later we could also have --report=json?

rixx commented 4 years ago

I'm sorry, I can't read. There's a --format flag. Sorry for the noise!

thibaudcolas commented 4 years ago

👍 no problem! If you have a suggestion for documenting this better / the need for more "plain formatting" options please let me know. At least I can see how it’d be useful to have a "Guides" section on the website, with a succinct "integration with other tools" or similar.


For future reference, the current way to disable all color output would be either of:

# Plain text
curlylint --quiet --format compact your_templates/
# JSON
curlylint --quiet --format json your_templates/