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

Adds a system-provided checkmake hook for pre-commit #93

Merged
merged 3 commits into from
Apr 11, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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