Skip to content

Commit

Permalink
Merge branch 'clang-format' into 'master'
Browse files Browse the repository at this point in the history
Some clang-format enhancements

See merge request ogs/ogs!4683
  • Loading branch information
bilke committed Jul 19, 2023
2 parents 7279c4a + d0aab3c commit 3eb9bfd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,11 @@ repos:
hooks:
- id: ruff
files: "Applications/Python/.*"
# Enable on demand, run with
# pre-commit run --all-files clang-format
#
# - repo: https://github.com/pocc/pre-commit-hooks
# rev: master
# hooks:
# - id: clang-format
# args: ["-i"]
1 change: 0 additions & 1 deletion scripts/ci/jobs/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ clang-format:
rules:
- if: $CI_MERGE_REQUEST_IID
needs: [ci_images]
allow_failure: true
script:
- git clang-format --extensions "h,cpp" ${CI_MERGE_REQUEST_DIFF_BASE_SHA}
- if [[ $(git diff) ]]; then exit 1; fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ Use [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html). It can be ad

The current style is defined in [.clang-format](https://gitlab.opengeosys.org/ogs/ogs/-/blob/master/.clang-format).

You can also run via the command line:

```bash
clang-format -i path/to/file.cpp
# OR clang-format on changed lines only:
git clang-format -i path/to/file.cpp
# OR run on all files, e.g.:
find -E . -regex '.*\.(cpp|h)' -exec clang-format -i {} \;
```

## Python

Use [`black`](https://black.readthedocs.io/en/stable/). It can be added to be automatically run on save in your editor / IDE:
Expand Down

0 comments on commit 3eb9bfd

Please sign in to comment.