Skip to content

Commit

Permalink
Update docs with command line for clang-format from clang-format-lint…
Browse files Browse the repository at this point in the history
…-action.
  • Loading branch information
ni4 committed May 29, 2024
1 parent e69b091 commit a8f2318
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/develop.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ docker commit clang-format clang-format
docker rm clang-format
--

How to use pre-built docker container from the linter action please see below.

You can then reformat a file (say, `src/lib/crypto/bn.cpp`) like so:

[source,console]
Expand All @@ -280,6 +282,29 @@ docker run --rm -v $PWD:/rnp -w /rnp clang-format clang-format -style=file -i `g
docker run --rm -v $PWD:/rnp -w /rnp clang-format clang-format -style=file -i `git diff --name-only 54c5476..HEAD |grep "\.\(c\|h\|cpp\)\$"`
--

==== clang-format (manually, using the docker container from the clang-format-lint-action)

Build container:

[source,console]
--
docker build -t clang-format-lint github.com/DoozyX/clang-format-lint-action
--

Get a diff with formatting errors:

[source,console]
--
docker run -it --rm --workdir /src -v $(pwd):/src clang-format-lint --clang-format-executable /clang-format/clang-format11.0.0 -r --exclude .git .
--

To edit files in-place, fixing the formatting errors, you should add `--inplace` parameter:

[source,console]
--
docker run -it --rm --workdir /src -v $(pwd):/src clang-format-lint --clang-format-executable /clang-format/clang-format11.0.0 -r --exclude .git . --inplace true
--

=== Style Guide

In order to keep the code base consistent, we should define and adhere
Expand Down

0 comments on commit a8f2318

Please sign in to comment.