mirror of
https://github.com/wiiu-env/clang-format-checker-docker.git
synced 2024-11-16 16:29:15 +01:00
README.md: Add other examples and output sample
This commit is contained in:
parent
f835624dfb
commit
53952659c3
30
README.md
30
README.md
@ -4,14 +4,40 @@ Docker image verifying the code format with clang-format
|
||||
|
||||
## Getting Started
|
||||
|
||||
Mount the source folder in the `src` working directory and run the format checker
|
||||
The following command will mount the current working directory folder to the `src` working directory, and check its format
|
||||
|
||||
`docker run --rm -v $(pwd):/src witekio/clang-format-checker`
|
||||
|
||||
The return code will be
|
||||
* `1` if any formatting errors are found, and printed in the standard output.
|
||||
* `non-zero` if any formatting errors are found, and printed in the standard output.
|
||||
* `0` if no issue was found
|
||||
|
||||
```
|
||||
$ docker run -v $(pwd):/src --rm witekio/clang-format-checker 2 ↵
|
||||
--- ./testCode/File.cpp (original)
|
||||
+++ ./testCode/File.cpp (reformatted)
|
||||
@@ -3,18 +3,13 @@
|
||||
|
||||
#include "MyHeader.h"
|
||||
|
||||
-MyClass::MyClass()
|
||||
+MyClass::MyClass()
|
||||
- : arg(new Other(std::string("string"), 4))
|
||||
- : arg(new Other(std::string("string"), 4))
|
||||
```
|
||||
|
||||
## Changing the style
|
||||
|
||||
The style used by `clang-format` can be defined by providing a `.clang-format` file in your source folder. For more information, see [clang-format style options](https://clang.llvm.org/docs/ClangFormatStyleOptions.html)
|
||||
|
||||
## Specify the files to check
|
||||
|
||||
Check recursively .h/.cpp files excluding `vendors` folder
|
||||
|
||||
`docker run --rm -v $(pwd):/src witekio/clang-format-checker "--extensions=h,cpp --exclude vendors"`
|
||||
|
||||
For more information, you can check [`run-clang-format`](https://github.com/Sarcasm/run-clang-format) repository
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
||||
|
Loading…
Reference in New Issue
Block a user