Skip to content

Conversation

@michael-delarue-axomic
Copy link
Contributor

This seems to solve problems with running checkmake from pre-commit. It very simply makes the Makefile argument optional which means that checkmake doesn't seem to run.
(see also #80 and some comments on other (closed) issues (e.g. #69)

Checklist

Not all of these might apply to your change but the more you are able to check
the easier it will be to get your contribution merged.

  • [x ] CI passes
  • [x ] Description of proposed change
  • [x ] Documentation (README, docs/, man pages) is updated
  • [x ] Existing issue is referenced if there is one
  • [!! ] Unit tests for the proposed change

no unit test yet since this basically does nothing. Might investigate learning how to do that if considered worthwhile.

@michael-delarue-axomic
Copy link
Contributor Author

According to the pre-commit documentation for adding new hooks the default is not to run hooks when there are no files to be checked and the checkmake hook configuration does not override this, so I am not really sure why this is helping, but it has.

@colindean
Copy link
Contributor

Can you show the output you're seeing when it fails? I've used checkmake at rev c047d51 for many months now without a problem across more than a dozen repos.

@mrtazz
Copy link
Collaborator

mrtazz commented Aug 17, 2023

it would be good to have a more detailed description here of what exactly fails and how this is fixing it. Especially since there are reports where things are working.

@reactive-firewall
Copy link

Alternative perspective

the pitch

Conversely to making the need to specify a file (e.g., the path to a makefile) to scan/lint an option, I'd suggest adding an option to search/find obvious makefiles, such as files named "[mM]akefile" or ending with ".make" or with ".makefile" (and of-course accept an optional custom argument for users to specify glob patterns).

TL;DR - some risks

  1. Changing to allow omitting the currently required makefile argument would regress the trivial use-case where a zero-length path (e.g., some script variable erroneously expanded to empty-string ""), instead of the required makefile path to a possible false-success.

example (hint for regression testing):

MAKE_FILES=$(git ls-files --exclude-standard -- includes/enable_*.make 2>/dev/null)  # assume the expected matches are not on the current branch (no enabled includes)
checkmake $MAKE_FILES  # currently will fail due to no valid paths
exit $?  # pass the pass/fail to caller

However if made optional the example case would change behavior to no-longer fail just because MAKE_FILES is empty. And, of-course, the bash code can be changed to preemptively check the variable (e.g., test -z $MAKE_FILES || exit 1), but the point is in how that is not necessary with the current implementation.


Thanks for reading this far,
🙇 Hope this helps

@obnoxxx
Copy link
Collaborator

obnoxxx commented May 27, 2025

@michael-delarue-axomic , as @mrtazz has already requested, could you please describe with some level of detail, what exactly is the problem that this PR is intended to fix?

I. E., please give a precise description of and steps to reproduce the issue.

@obnoxxx
Copy link
Collaborator

obnoxxx commented May 27, 2025

@michael-delarue-axomic also, the change looks simple enough but I can't really see what behavior changes it introduces.

Could you add example invocations with and without the patch with different results?

@obnoxxx
Copy link
Collaborator

obnoxxx commented Jun 11, 2025

rebased on current main branch

@obnoxxx
Copy link
Collaborator

obnoxxx commented Jun 11, 2025

rebased on current main branch

The branch update button created a merge commit which makes no sense IMHO.

So I creaded a clean rebase locally and updated the PR.

rebased on current main branch

Copy link
Collaborator

@obnoxxx obnoxxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't really understand the purpose of this change but the patch is clean and the change does not impact behavior negatively for me, so I think we can just take it without further ado.

LGTM.

@obnoxxx obnoxxx merged commit c71a948 into checkmake:main Jun 11, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

5 participants