Add support for indent
(C autoformatter)
#4817
Labels
new tool
Support for new linters, fixers, etc.
indent
(C autoformatter)
#4817
Name: indent
URL: https://www.gnu.org/software/indent/
indent(1)
is a program for automatically formatting C code. The GNU variant supports common style shortcuts such as-kr
.This small UNIX trickery makes it a linter as well:
There's no message but the diff can be processed to output a simple generic "lint error" on relevant lines which would already go a long way. It could also be processed to suggest fixes.
It can also read from stdin if so desired:
Manuals:
Both modify in place and produce backup files if no output file is provided, this is probably undesirable so the
/dev/stdout
trickery might be preferred.BSD
indent
does not use-o
for output but a mere additional argument instead: GNU vs BSD should be detected to pass things around properly.BSD indent supports much less features too, notably it does not support common styles like
-kr
and not all of what's behind-kr
so if BSD indent is detected it could be convenient to have high level options to mimic GNU style flags when BSD indent is detected, e.g K&R would be:So having a
g:ale_c_indent_style = 'kr'
would automatically (e.g by settingg:ale_c_indent_options
) use-kr
with GNUindent
and the above with BSDindent
.The text was updated successfully, but these errors were encountered: