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

Feature: Recurse over directories #85

Open
mcandre opened this issue Mar 21, 2023 · 0 comments
Open

Feature: Recurse over directories #85

mcandre opened this issue Mar 21, 2023 · 0 comments

Comments

@mcandre
Copy link

mcandre commented Mar 21, 2023

For large projects containing many makefiles, it would help the user out if checkmake automatically recursed over directories.

Basically, use Go's builtin filepath Walk functionality, and ignore any non-directory files that do not match the conventional POSIX, GNU, or BSD makefile name patterns. Case insensitive.

As a workaround, the user can supply a UNIX find command for this, though that breaks in many Windows contexts, and requires the user to maintain a UNIX find command, which is notoriously fragile.

This probably works as intended on WSL and other POSIX sh environments. But I'd love to see checkmake just do this automatically with directory paths, e.g. checkmake ., similar to how other modern linters behave.

Makefile:

checkmake:
	@find . \
		-type f \
		\( \
			-iname Makefile -o \
			-iname GNUmakefile -o \
			-iname '*.mk' -o \
			-iname '*.make' \
		\) \
		-print0 | \
		xargs -0 -n 1 checkmake

Usage: make checkmake.

Hilariously, that find command violates checkmake's default maxbodylength of 5 lines.

Also, checkmake does not currently preface its warnings with the name of the filepath to the makefile in question. So for large projects with many makefiles, the resulting linting report is unclear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant