Skip to content

Conversation

@obnoxxx
Copy link
Collaborator

@obnoxxx obnoxxx commented May 19, 2025

Description of changes

This changes the minphony rule to
allow the required phony targets to be overridden by the config file.

Resolves: #113

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.

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

@obnoxxx obnoxxx force-pushed the rules-minphony-honor-config branch from be2d51d to d906f20 Compare May 19, 2025 17:33
@obnoxxx obnoxxx changed the title rules: let minphony honor config rules(minphon): allow overriding required phony targets in config May 19, 2025
@obnoxxx obnoxxx changed the title rules(minphon): allow overriding required phony targets in config rules(minphony): allow overriding required phony targets in config May 19, 2025
@obnoxxx
Copy link
Collaborator Author

obnoxxx commented May 19, 2025

@mrtazz the CI fails on ./checkmake Makefile with the maxbodylength rule for the pizza and coverage targets but that is even the case for plain main. I don't understand yet how this can be the case and previous PRs did not have this problem 🤷🏼

@obnoxxx
Copy link
Collaborator Author

obnoxxx commented May 19, 2025

@mrtazz the CI fails on ./checkmake Makefile with the maxbodylength rule for the pizza and coverage targets but that is even the case for plain main. I don't understand yet how this can be the case and previous PRs did not have this problem 🤷🏼

Well, I was not quite right:

  • with current main, ./checkmake Mainpasses just fine, but:
  • building from this PR locally, it fails like in the CI.
./checkmake  Makefile 
      RULE                 DESCRIPTION             FILE NAME   LINE NUMBER  
                                                                            
  maxbodylength   Target body for "coverage"       Makefile    75           
                  exceeds allowed length of 5                               
                  lines (8).                                                
  maxbodylength   Target body for "pizza"          Makefile            159  
                  exceeds allowed length of 5                               
                  lines (6). 

This confuses me since this PR does not have any diff that would explain this to me.
In particular, it does not change the maxbodylength rule...

@obnoxxx obnoxxx force-pushed the rules-minphony-honor-config branch from d906f20 to 7b60e74 Compare May 19, 2025 19:47
@obnoxxx
Copy link
Collaborator Author

obnoxxx commented May 19, 2025

@mrtazz the CI fails on ./checkmake Makefile with the maxbodylength rule for the pizza and coverage targets but that is even the case for plain main. I don't understand yet how this can be the case and previous PRs did not have this problem 🤷🏼

Well, I was not quite right:

* with current `main`, `./checkmake Main`passes just fine, but:

* building from this PR locally, it fails like in the CI.

This confuses me since this PR does not have any diff that would explain this to me. In particular, it does not change the maxbodylength rule...

I missed the fact that I accidentally committed the removal of the checkmake.ini file which explains the failure since it overrode the maxBodyLength setting from the default of 5to 8.

Restoring the file has fixed the CI.

@obnoxxx
Copy link
Collaborator Author

obnoxxx commented May 20, 2025

added manpage update.

@obnoxxx
Copy link
Collaborator Author

obnoxxx commented May 20, 2025

I am currently trying to complete this PR by adding some unit test for the new behavior but still struggling with failures that I need to get rid of before updating.

@obnoxxx obnoxxx force-pushed the rules-minphony-honor-config branch from 0ebb243 to d635ea6 Compare May 20, 2025 13:28
@obnoxxx
Copy link
Collaborator Author

obnoxxx commented May 20, 2025

I am currently trying to complete this PR by adding some unit test for the new behavior but still struggling with failures that I need to get rid of before updating.

added the test to the PR even though I know it is currently failing.
Seeing the failure in the CI might make troubleshooting and fixing it more easy.

@obnoxxx
Copy link
Collaborator Author

obnoxxx commented May 20, 2025

while there is still a failure of make testthat needs to be resolved, this PR satisfies the request of issue #113 :

$ cat test.ini
[maxbodylength]
maxBodyLength = 3
[minphony]
required = foo, bar
$ cat test.mk


.PHONY: long
long:
   @echo 1
   @echo 2
   @echo 3
   @echo 4
   @echo 5
   @echo 6
   @echo 7
   @echo 8
   @echo 9

$ make clean checkmake
...
$ ./checkmake --config=./test.ini ./test.mk 
     RULE                 DESCRIPTION             FILE NAME   LINE NUMBER  
                                                                           
 minphony        Missing required phony target    ./test.mk   3            
                 "foo"                                                     
 minphony        Missing required phony target    ./test.mk   3            
                 "bar"                                                     
 maxbodylength   Target body for "long" exceeds   ./test.mk   4            
                 allowed length of 3 lines (9).
$ echo $?
3
$ 

@obnoxxx obnoxxx force-pushed the rules-minphony-honor-config branch from d635ea6 to aed5b1c Compare May 20, 2025 20:45
@obnoxxx
Copy link
Collaborator Author

obnoxxx commented May 20, 2025

test fixed 😄

@obnoxxx obnoxxx force-pushed the rules-minphony-honor-config branch from aed5b1c to cf04577 Compare May 21, 2025 09:41
@obnoxxx
Copy link
Collaborator Author

obnoxxx commented May 21, 2025

updated once more to undo accidentally committed changes to rules/minphony/minphony_test.gothat were done by my editor formatting with gofmt upon saving.

obnoxxx added 2 commits May 21, 2025 12:13
This changes the minphony rule to
allow the required phony targets to be
overridden  in the config file.

Fixes: checkmake#113

Signed-off-by: Michael Adam <obnox@samba.org>
This enhances the manpage by adding a description of how to
override the configuration of the maxbodylength and minphony rules from
thre config file.

Signed-off-by: Michael Adam <obnox@samba.org>
@obnoxxx
Copy link
Collaborator Author

obnoxxx commented May 22, 2025

@mrtazz any thoughts about this one? 😉

@obnoxxx obnoxxx merged commit 329a265 into checkmake:main May 25, 2025
1 check passed
@obnoxxx obnoxxx mentioned this pull request May 25, 2025
@obnoxxx obnoxxx mentioned this pull request Sep 25, 2025
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.

config can not override default minphony required targets

1 participant