pocc / pre-commit-hooks

C/C++ hooks to integrate with pre-commit
Apache License 2.0
323 stars 67 forks source link

clang format failed #54

Closed ypearson closed 1 year ago

ypearson commented 1 year ago
pre-commit run
clang-format.............................................................Failed
- hook id: clang-format
- exit code: 1

firmware/src/main.cpp
====================
--- original
+++ formatted
@@ -33,7 +33,7 @@
 // Section: Main Entry Point
 // *****************************************************************************
 // *****************************************************************************
-int x= 0;
+int x = 0;
 int main(void) {
which clang-format
/home/USER/.local/bin/clang-format

Ubuntu 22 LTS clang-format LLVM installed locally

Any way to find out why it failed?

thanks

gsmithufl commented 1 year ago

It literally tells you right there. It says your file is incorrectly formatted and provides the diff of the change.

pocc commented 1 year ago

I'm agreeing with Garrett here. You can see that inx= 0, there's no space between x and =:

-int x= 0;
+int x = 0;

You may want to read up on how to read diffs: https://unix.stackexchange.com/questions/81998/understanding-of-diff-output

Closing this.