diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 2f3559f4e9..79df60165c 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -3,5 +3,5 @@ - id: dotnet-format name: dotnet format language: dotnet - types: ['c#'] - entry: dotnet-format + types_or: ['c#', 'vb'] + entry: dotnet-format --include diff --git a/docs/integrations.md b/docs/integrations.md index db833b3f30..15ae9f017a 100644 --- a/docs/integrations.md +++ b/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 @@ -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)