Skip to content

Commit

Permalink
Merge pull request #93 from colindean/patch-1
Browse files Browse the repository at this point in the history
Adds a system-provided checkmake hook for pre-commit
  • Loading branch information
mrtazz authored Apr 11, 2023
2 parents c047d51 + 8d51504 commit c865c5d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exclude: |
)$
repos:
- repo: https://github.com/mrtazz/checkmake.git
rev: 0.2.2
rev: main
hooks:
- id: checkmake
exclude: |
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@
language: golang
pass_filenames: true
types: [makefile]
- id: checkmake-system
name: Makefile linter/analyzer
entry: checkmake
language: system
types: [makefile]
pass_filenames: true
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,36 @@ repos. Simply add a `.pre-commit-config.yaml` to your repo's top-level directory
```yaml
repos:
- repo: https://github.com/mrtazz/checkmake.git
# Or another commit hash or version
rev: 0.2.2
hooks:
# Use this hook to let pre-commit build checkmake in its sandbox
- id: checkmake
# OR Use this hook to use a pre-installed checkmark executable
# - id: checkmake-system
```

Then, run `pre-commit` as usual. For example:
There are two hooks available:

- `checkmake` (Recommended)

pre-commit will set up a Go environment from scratch to compile and run checkmake.
See the [pre-commit `golang` plugin docs](https://pre-commit.com/#golang) for more information.

- `checkmake-system`

pre-commit will look for `checkmake` on your `PATH`.
This hook requires you to install `checkmake` separately, e.g. with your package manager or [a prebuilt binary release](https://github.com/mrtazz/checkmake/releases).
Only recommended if it's permissible to require all repository users install `checkmake` manually.

Then, run `pre-commit` as usual as a part of `git commit` or explicitly, for example:

```sh
pre-commit run --all-files
```

### pre-commit in GitHub Actions

You may also choose to run this as a GitHub Actions workflow. To do this, add a
`.github/workflows/pre-commit.yml` workflow to your repo:

Expand Down

0 comments on commit c865c5d

Please sign in to comment.