Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .pre-commit-hooks.yaml #872

Merged
merged 10 commits into from Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .pre-commit-hooks.yaml
@@ -0,0 +1,7 @@
---

- id: dotnet-format
name: dotnet format
language: dotnet
types_or: ['c#', 'vb']
entry: dotnet-format --include
19 changes: 17 additions & 2 deletions docs/integrations.md
@@ -1,7 +1,7 @@
# Integrations
Collection of advice how to auto check/format. Every sample expects dotnet format installed as local tool.
Collection of advice how to auto check/format. Every sample expects dotnet format installed as local tool, unless otherwise noted.

## Pre-commit hook to reformat
## Git pre-commit hook to reformat

Create file `.git/pre-commit` with following contents:
```sh
Expand Down Expand Up @@ -46,3 +46,18 @@ Add following to your build file:


These instructions originally authored by [leotsarev](https://github.com/joinrpg/joinrpg-net/).


## [pre-commit.com](https://pre-commit.com/) hook to reformat

Add the following block to the `repos` section of your `.pre-commit-config.yaml` file:

```yaml
- repo: https://github.com/dotnet/format
rev: "" # Specify a tag or sha here, or run "pre-commit autoupdate"
hooks:
- id: dotnet-format
```
Note that this will install dotnet format to an isolated environment, using the system installation of the dotnet CLI. See the [pre-commit.com documentation](https://pre-commit.com/#dotnet) for more details.

These instructions originally authored by [rkm](https://github.com/rkm)