asf-tooling commented on issue #886:
URL:
https://github.com/apache/tooling-trusted-releases/issues/886#issuecomment-4410072573
<!-- gofannon-issue-triage-bot v2 -->
**Automated triage** — analyzed at `main@2da7807a`
**Type:** `new_feature` • **Classification:** `actionable` •
**Confidence:** `high`
**Application domain(s):** `shared_infrastructure`
### Summary
Issue proposes adding checkmake (a Makefile linter) as a pre-commit hook.
The repository has a substantial Makefile with many targets and already uses
numerous pre-commit hooks for various file types but has no Makefile-specific
linting. This is a straightforward, low-risk addition to the pre-commit
configuration. No prior discussion exists on the issue.
### Where new code would go
- `.pre-commit-config.yaml` — after shellcheck-py hook (line 57)
checkmake is a lightweight linter for build infrastructure files,
logically grouped with shellcheck which lints shell scripts.
### Proposed approach
Add checkmake as a pre-commit hook in `.pre-commit-config.yaml`, positioned
after the shellcheck hook. The hook should target only the root Makefile (using
`files: (^|/)Makefile$` to be safe). checkmake is a Go binary distributed via
its own repo hook, so no additional Python dependencies are needed.
A `.checkmake.ini` configuration file may be needed if checkmake flags any
rules that are intentionally violated in this project's Makefile (e.g., if the
project uses certain patterns that checkmake considers non-idiomatic). The
initial addition should use default rules and any necessary exclusions can be
added after seeing what gets flagged.
### Suggested patches
#### `.pre-commit-config.yaml`
Add checkmake hook after shellcheck to lint Makefiles
````diff
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -54,6 +54,10 @@
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.11.0.1
hooks:
- id: shellcheck
+- repo: https://github.com/checkmake/checkmake
+ rev: 0.2.2 # TODO: confirm latest release tag
+ hooks:
+ - id: checkmake
- repo: https://github.com/rtts/djhtml
rev: 3.0.11
hooks:
````
### Open questions
- What is the latest stable release tag for checkmake? The issue references
the repo but the rev '0.2.2' should be confirmed.
- Does checkmake flag any false positives on the current Makefile that would
require a .checkmake.ini configuration file to suppress?
- Should a .checkmake.ini be added proactively to configure rules, or should
defaults be used first and adjusted as needed?
### Files examined
- `.pre-commit-config.yaml`
- `.pre-commit-heavy.yaml`
- `.pre-commit-light.yaml`
- `Makefile`
- `.github/workflows/analyze.yml`
- `pyproject.toml`
- `DEVELOPMENT.md`
---
*Draft from a triage agent. A human reviewer should validate before merging
any change. The agent did not run tests or verify diffs apply.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]