Skip to content

Commit

Permalink
Merge pull request #136 from PointKernel/auto-formatting
Browse files Browse the repository at this point in the history
Auto formatting via `pre-commit.ci`
  • Loading branch information
PointKernel authored Jan 27, 2022
2 parents de32df2 + 76eb082 commit 2b83c76
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
21 changes: 11 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
ci:
autofix_commit_msg: |
[pre-commit.ci] auto code formatting
autofix_prs: true
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: quarterly
skip: []
submodules: false

repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v11.1.0
rev: v13.0.0
hooks:
- id: clang-format
# Using the pre-commit stage to simplify invocation of all
# other hooks simultaneously (via any other hook stage). This
# can be removed if we also move to running clang-format
# entirely through pre-commit.
stages: [commit]
name: clang-format
description: Format files with ClangFormat.
entry: clang-format
language: system
files: \.(cu|cuh|h|hpp|cpp|inl)$
'types_or': [file]
args: ['-fallback-style=none', '-style=file', '-i']
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,11 @@ Binaries will be built into:

## Code Formatting

`cuCollections` uses [`pre-commit`](https://pre-commit.com/) along with [`mirrors-clang-format`](https://github.com/pre-commit/mirrors-clang-format) to format the C++/CUDA files.
To install `pre-commit` via `conda` or `pip`:
By default, `cuCollections` uses [`pre-commit.ci`](https://pre-commit.ci/) along with [`mirrors-clang-format`](https://github.com/pre-commit/mirrors-clang-format) to automatically format the C++/CUDA files in a pull request.
Users should enable the `Allow edits by maintainers` option to get auto-formatting to work.

### Pre-commit hook
Optionally, you may wish to setup a [`pre-commit`](https://pre-commit.com/) hook to automatically run `clang-format` when you make a git commit. This can be done by installing `pre-commit` via `conda` or `pip`:

```bash
conda install -c conda-forge pre_commit
Expand All @@ -104,7 +107,7 @@ pre-commit install

from the root of the `cuCollections` repository. Now code formatting will be run each time you commit changes.

Optionally, you may wish to manually format the code:
You may also wish to manually format the code:
```bash
pre-commit run clang-format --all-files
```
Expand Down

0 comments on commit 2b83c76

Please sign in to comment.