mikr/whatstyle

clang-format on debian unrecognized

Closed this issue · 2 comments

aganm commented

I'm trying to use whatstyle on debian with clang-format but I'm getting this error

Unknown formatter type clang-format Debian clang-format version 11.0.1-2
Currently only these formatters are supported: clang-format, yapf, uncrustify, astyle, indent, tidy, scalariform, scalafmt, rfmt, rustfmt

I'm not sure what to do to fix this. Any idea?

mikr commented

It's funny. All of the dozen or so formatters report an identifiable string prefix given the --version parameter, like so:

$ clang-format --version
clang-format version 11.1.0

But of all Linux distributions and all other operating systems Debian is the only one that finds it useful to stick their distro name into the version output of clang-format.

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux bullseye/sid
Release:	testing
Codename:	bullseye
$ clang-format --version
Debian clang-format version 11.0.1-2

To fix this issue please look for this code fragment in whatstyle.py:
('clang-format', ClangFormatter),

and insert the following line below it:
('Debian clang-format', ClangFormatter),

"Debian clang-format" is then recognized and whatstyle hopefully works for you.
I won't add this to whatstyle though because it is needless breakage that should be
fixed by Debian.

aganm commented

Thanks!