← 返回
未分类 中文

Makefile Linter

Lint Makefiles for common issues — tabs, .PHONY, unused vars, portability, and best practices.
对 Makefile 进行 lint 检查,发现常见问题——制表符、.PHONY、未使用变量、可移植性和最佳实践
charlie-morrison charlie-morrison 来源
未分类 clawhub v1.0.1 1 版本 100000 Key: 无需
★ 0
Stars
📥 406
下载
💾 1
安装
1
版本
#latest

概述

makefile-linter

A pure-Python 3 (stdlib only) Makefile linter. Detects common issues including tab/space errors, missing .PHONY declarations, unused/undefined variables, hardcoded paths, shell portability problems, and more.

Commands

lint FILE

Lint a Makefile and report issues.

python3 scripts/makefile-linter.py lint Makefile
python3 scripts/makefile-linter.py lint /path/to/Makefile
echo -e "all:\n\techo hello" | python3 scripts/makefile-linter.py lint /dev/stdin

targets FILE

List all targets with line numbers, phony status, prerequisites, and inline comment descriptions.

python3 scripts/makefile-linter.py targets Makefile
python3 scripts/makefile-linter.py targets Makefile --format json

vars FILE

List all variable definitions with line numbers and values.

python3 scripts/makefile-linter.py vars Makefile
python3 scripts/makefile-linter.py vars Makefile --format markdown

audit FILE

Full audit combining lint results, targets list, and variables summary.

python3 scripts/makefile-linter.py audit Makefile
python3 scripts/makefile-linter.py audit Makefile --format json

Options

FlagDescription
-------------------
`--format text\json\markdown`Output format (default: text)
--strictExit code 1 on any reported issue
--ignore RULEIgnore a specific rule (repeatable)
`--min-severity error\warning\info`Minimum severity to report (default: info)

Lint Rules

RuleSeverityDescription
-----------------------------
spaces-not-tabserrorRecipe lines must use tabs, not spaces
duplicate-targetserrorSame target defined more than once
missing-phonywarningCommon phony target not in .PHONY
unused-variableswarningVariable defined but never referenced
undefined-variableswarningVariable referenced but never defined
hardcoded-pathswarningAbsolute paths in recipes
trailing-whitespacewarningLines ending with spaces or tabs
shell-portabilitywarningBash-specific syntax without SHELL := /bin/bash
recursive-makeinfo$(MAKE) -C or make -C detected
missing-default-targetinfoNo all target defined
long-linesinfoLines over 120 characters
missing-cleaninfoNo clean target defined

Examples

# Report only errors and warnings
python3 scripts/makefile-linter.py lint Makefile --min-severity warning

# JSON output for CI integration
python3 scripts/makefile-linter.py lint Makefile --format json

# Fail CI on any issue
python3 scripts/makefile-linter.py lint Makefile --strict

# Ignore specific rules
python3 scripts/makefile-linter.py lint Makefile --ignore recursive-make --ignore missing-clean

# Full audit in Markdown (for PR comments)
python3 scripts/makefile-linter.py audit Makefile --format markdown

# Pipe from stdin
cat Makefile | python3 scripts/makefile-linter.py lint /dev/stdin

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-05-07 05:52 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 198 📥 68,231
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 686 📥 331,081
dev-programming

YouTube

byungkyu
使用托管OAuth集成YouTube Data API,支持搜索视频、管理播放列表、获取频道数据及评论互动,适用于用户需要时使用此技能。
★ 142 📥 42,118