checkmake
This linter has been disabled in this version
Disabled reason: Security issues: https://github.com/checkmake/checkmake/issues/99
checkmake is a linter for Makefiles that helps enforce best practices and identify common issues in Makefile syntax and structure. It helps prevent common Makefile pitfalls and makes build processes more reliable and maintainable.
Key Features:
- Makefile rule validation ensuring proper target and dependency syntax
- Proper indentation checking verifying correct tab usage vs. spaces
- Variable usage verification detecting undefined or misused variables
- Target naming convention enforcement following Makefile best practices
- Missing dependency detection preventing incomplete build processes
- Unreachable target identification optimizing Makefile structure
- Tab character validation ensuring Make compatibility requirements
- Rule pattern analysis catching common syntax errors
- Configuration file support via
.checkmake.ini
for project-specific rules - Detailed error reporting with line numbers and suggestions
- Build optimization suggestions improving compilation efficiency
checkmake documentation
- Version in MegaLinter: 0.2.0
- Visit Official Web Site
- See How to configure checkmake rules
Configuration in MegaLinter
- Enable checkmake by adding
MAKEFILE_CHECKMAKE
in ENABLE_LINTERS variable - Disable checkmake by adding
MAKEFILE_CHECKMAKE
in DISABLE_LINTERS variable
Variable | Description | Default value |
---|---|---|
MAKEFILE_CHECKMAKE_ARGUMENTS | User custom arguments to add in linter CLI call Ex: -s --foo "bar" |
|
MAKEFILE_CHECKMAKE_COMMAND_REMOVE_ARGUMENTS | User custom arguments to remove from command line before calling the linter Ex: -s --foo "bar" |
|
MAKEFILE_CHECKMAKE_FILTER_REGEX_INCLUDE | Custom regex including filter Ex: (src\|lib) |
Include every file |
MAKEFILE_CHECKMAKE_FILTER_REGEX_EXCLUDE | Custom regex excluding filter Ex: (test\|examples) |
Exclude no file |
MAKEFILE_CHECKMAKE_CLI_LINT_MODE | Override default CLI lint mode - file : Calls the linter for each file- project : Call the linter from the root of the project |
file |
MAKEFILE_CHECKMAKE_FILE_EXTENSIONS | Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all filesEx: [".py", ""] |
Exclude every file |
MAKEFILE_CHECKMAKE_FILE_NAMES_REGEX | File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files Ex: ["Dockerfile(-.+)?", "Jenkinsfile"] |
["Makefile"] |
MAKEFILE_CHECKMAKE_PRE_COMMANDS | List of bash commands to run before the linter | None |
MAKEFILE_CHECKMAKE_POST_COMMANDS | List of bash commands to run after the linter | None |
MAKEFILE_CHECKMAKE_UNSECURED_ENV_VARIABLES | List of env variables explicitly not filtered before calling MAKEFILE_CHECKMAKE and its pre/post commands | None |
MAKEFILE_CHECKMAKE_CONFIG_FILE | checkmake configuration file nameUse LINTER_DEFAULT to let the linter find it |
.checkmake.ini |
MAKEFILE_CHECKMAKE_RULES_PATH | Path where to find linter configuration file | Workspace folder, then MegaLinter default rules |
MAKEFILE_CHECKMAKE_DISABLE_ERRORS | Run linter but consider errors as warnings | false |
MAKEFILE_CHECKMAKE_DISABLE_ERRORS_IF_LESS_THAN | Maximum number of errors allowed | 0 |
MAKEFILE_CHECKMAKE_CLI_EXECUTABLE | Override CLI executable | ['checkmake'] |
MegaLinter Flavors
This linter is available in the following flavors
Flavor | Description | Embedded linters | Info | |
---|---|---|---|---|
![]() |
all | Default MegaLinter Flavor | 126 |
Behind the scenes
How are identified applicable files
- File names (regex):
Makefile
How the linting is performed
- checkmake is called one time by identified file (
file
CLI lint mode)
Example calls
checkmake Makefile
checkmake --config .checkmake.ini Makefile
Help content
checkmake.
Usage:
checkmake [options] <makefile>
checkmake -h | --help
checkmake --version
checkmake --list-rules
Options:
-h --help Show this screen.
--version Show version.
--debug Enable debug mode
--config=<configPath> Configuration file to read
--format=<format> Output format as a Golang text/template template
--list-rules List registered rules
Installation on mega-linter Docker image
- Dockerfile commands :
FROM mrtazz/checkmake:latest AS checkmake
COPY --link --from=checkmake /checkmake /usr/bin/checkmake
- APK packages (Linux):