mrtazz / checkmake

experimental linter/analyzer for Makefiles
MIT License
1.04k stars 45 forks source link

Simply expanded rule triggered for seemingly nothing #38

Closed dogmatic69 closed 4 years ago

dogmatic69 commented 4 years ago

Related to #17

Expected behaviour

check should pass

Actual behaviour

        RULE                   DESCRIPTION             LINE NUMBER  

  timestampexpanded   Variable "PHONY" possibly        13           
                      contains a timestamp and                      
                      should be simply expanded. 

Output of checkmake --version

$ /checkmake --version
checkmake 0.1.0-39-g1383019 built at 2020-04-07T19:00:22Z by  <> with go version go1.13.9 linux/amd64

Output of checkmake --debug <your makefile>

2020/04/07 22:41:06 Unable to match line '' to a Rule or Variable
2020/04/07 22:41:06 Unable to match line 'TERRAFORM_MODULE_PATH ?= $(realpath ./)' to a Rule or Variable
2020/04/07 22:41:06 Unable to match line '' to a Rule or Variable
2020/04/07 22:41:06 Unable to match line '' to a Rule or Variable
2020/04/07 22:41:06 Unable to match line '' to a Rule or Variable
2020/04/07 22:41:06 Unable to match line '' to a Rule or Variable
2020/04/07 22:41:06 Unable to match line '' to a Rule or Variable
2020/04/07 22:41:06 Unable to match line '' to a Rule or Variable
2020/04/07 22:41:06 Unable to match line '' to a Rule or Variable
2020/04/07 22:41:06 Running rule 'phonydeclared'...
2020/04/07 22:41:06 Running rule 'timestampexpanded'...
2020/04/07 22:41:06 Running rule 'maxbodylength'...
2020/04/07 22:41:06 Running rule 'minphony'...

        RULE                   DESCRIPTION             LINE NUMBER  

  timestampexpanded   Variable "PHONY" possibly        25           
                      contains a timestamp and                      
                      should be simply expanded.                    

Output of make --version

Make is not available (using the docker image from this repo)

Sample Makefile to reproduce issue

TERRAFORM_MODULE_PATH ?= $(realpath ./)

.PHONY: all
all:

.PHONY: clean
clean:

.PHONY: test
test:

.PHONY: validate
validate:
    docker run -i --rm \
        -v $(TERRAFORM_MODULE_PATH):/data \
        hashicorp/terraform:light validate

(some of these things might not apply but the more you can provide the easier it will be to fix this bug. Thanks!)

fdegier commented 4 years ago

The code checks if the command contains the word date guess what validate contains :D