Skip to content

Commit

Permalink
Add info about linting commits
Browse files Browse the repository at this point in the history
  • Loading branch information
samfundev committed Dec 28, 2020
1 parent 176d2c4 commit f9d09fe
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
22 changes: 22 additions & 0 deletions hooks/SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Linting Commits
If you want [RepoLint](https://github.com/samfundev/RepoLint) to lint your commits, you can setup a hook to do that when committing new changes.

## Step 1: Git
Run the following command in this repo to get git to look for the hook in the hooks directory.
```sh
git config core.hooksPath hooks
```

## Step 2: RepoLint
Clone [RepoLint](https://github.com/samfundev/RepoLint) using the following command.
```sh
git clone https://github.com/samfundev/RepoLint
```

To build it, you'll need [.NET Core](https://dotnet.microsoft.com/download/dotnet-core). Then you should be able to run the following command in the `RepoLint` directory to build RepoLint.
```sh
dotnet build -c Release
```

## Step 3: PATH
RepoLint needs to be added to the PATH so that it can be used by the hook to lint files. To do this, add the `RepoLint/bin/Release` directory to your PATH.
3 changes: 3 additions & 0 deletions hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

git diff --diff-filter=d --cached --name-only -z | xargs --null -I % sh -c 'repolint "%" --repo'

0 comments on commit f9d09fe

Please sign in to comment.