Skip to content

Feature: Recurse over directories #85

@mcandre

Description

@mcandre

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions