Skip to content

[CI] Add pre-commit hook checkmake to lint Makefiles#2751

Merged
jiayuasu merged 1 commit intoapache:masterfrom
jbampton:add-pre-commit-hook-checkmake
Mar 16, 2026
Merged

[CI] Add pre-commit hook checkmake to lint Makefiles#2751
jiayuasu merged 1 commit intoapache:masterfrom
jbampton:add-pre-commit-hook-checkmake

Conversation

@jbampton
Copy link
Member

Added 3 hooks:

  • checkmake (root): with custom checkmake.ini
  • checkmake (python/sedona/doc): with custom checkmake.ini
  • insert-license: to auto insert license headers for ini files

Slightly relaxed config for phony target body "lengths"

Cleaned up the root Makefile removing the missing "test" target and adding "run-docs" target to the phony list

https://github.com/checkmake/checkmake

https://github.com/checkmake/checkmake?tab=readme-ov-file#pre-commit-usage

https://en.wikipedia.org/wiki/INI_file#Comments

Did you read the Contributor Guide?

Is this PR related to a ticket?

  • No:
    • this is a CI update. The PR name follows the format [CI] my subject

What changes were proposed in this PR?

Added 3 more hooks to our pre-commit framework.


Using checkmake—a static analysis linter for Makefiles—provides several benefits centered on maintaining build script quality and reliability.
The primary advantages of using this tool include:

  • Early Issue Detection: It identifies potential problems like missing required targets (e.g., all or test) or missing .PHONY declarations before you ever run the build.
  • Enforcement of Best Practices: The linter checks against a set of configurable rules to ensure your Makefile follows community-accepted standards for correctness and maintainability.
  • Customisable Rules: Users can define their own validation logic via a configuration file (checkmake.ini), allowing teams to enforce specific internal coding styles.
  • Flexible Output Formats: It supports both human-readable text and machine-readable JSON output, which is useful for integrating into various developer tools and automated pipelines.
  • Lightweight and Portable: Being written in Go, it can be run as a single binary, via Docker containers, or as a pre-commit hook without requiring a heavy runtime environment.

How was this patch tested?

With pre-commit

Did this PR include necessary documentation updates?

  • No, this PR does not affect any public API so no need to change the documentation.

Added 3 hooks:

- checkmake (root): with custom checkmake.ini
- checkmake (python/sedona/doc): with custom checkmake.ini
- insert-license: to auto insert license headers for ini files

Slightly relaxed config for phony target body "lengths"

Cleaned up the root Makefile removing the missing "test" target and adding "run-docs" target to the phony list

https://github.com/checkmake/checkmake

https://github.com/checkmake/checkmake?tab=readme-ov-file#pre-commit-usage

https://en.wikipedia.org/wiki/INI_file#Comments
@jiayuasu jiayuasu merged commit 02903cb into apache:master Mar 16, 2026
33 checks passed
@jbampton jbampton deleted the add-pre-commit-hook-checkmake branch March 16, 2026 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pre-commit Pull requests that update pre_commit code root

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants