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

'update' contains 'date' and so creates 'contains a timestamp' issue #64

Open
bcm-at-zama opened this issue Jan 19, 2022 · 2 comments
Open

Comments

@bcm-at-zama
Copy link

bcm-at-zama commented Jan 19, 2022

Expected behaviour

Makefile

.PHONY: update_my_stuff
update_my_stuffv:

.PHONY: all
all:

.PHONY: clean
clean:

.PHONY: test
test:

fails with

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

Actual behaviour

It should work.

The problem is that 'update' contains the word 'date', as in #38 and as fixed in #39. Notably, if you replace update_my_stuff by upda_te_my_stuff It works

Output of checkmake --version

checkmake 0.1.0-39-g1383019 built at 2020-10-27T22:53:40Z by <> with go version go1.15.3 linux/amd64

Output of checkmake --debug <your makefile>

2022/01/19 11:28:22 Unable to match line '' to a Rule or Variable
2022/01/19 11:28:22 Unable to match line 'update_my_stuffv:' to a Rule or Variable
2022/01/19 11:28:22 Unable to match line '' to a Rule or Variable
2022/01/19 11:28:22 Unable to match line '' to a Rule or Variable
2022/01/19 11:28:22 Unable to match line '' to a Rule or Variable
2022/01/19 11:28:22 Unable to match line '' to a Rule or Variable
2022/01/19 11:28:22 Unable to parse config file "checkmake.ini", running with defaults
2022/01/19 11:28:22 Running rule 'maxbodylength'...
2022/01/19 11:28:22 iniFile not initialized
2022/01/19 11:28:22 Running rule 'minphony'...
2022/01/19 11:28:22 iniFile not initialized
2022/01/19 11:28:22 Running rule 'phonydeclared'...
2022/01/19 11:28:22 iniFile not initialized
2022/01/19 11:28:22 Running rule 'timestampexpanded'...
2022/01/19 11:28:22 iniFile not initialized
2022/01/19 11:28:22 iniFile not initialized

    RULE                   DESCRIPTION             LINE NUMBER  

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

Output of make --version

I am in Docker so not sure it makes sense

Sample Makefile to reproduce issue

.PHONY: update_my_stuff
update_my_stuffv:

.PHONY: all
all:

.PHONY: clean
clean:

.PHONY: test
test:

@mrtazz
Copy link
Owner

mrtazz commented Feb 18, 2022

ah I can see this happening. Thanks for reporting. I think in addition to making the matching a bit better we should probably also never treat .PHONY as a variable name anyways.

@trinitronx
Copy link
Contributor

trinitronx commented Apr 29, 2022

I think in addition to making the matching a bit better we should probably also never treat .PHONY as a variable name anyways.

@mrtazz It's funny you mention that because I just happened to refactor it on my fork. I noticed it was treated as a SpecialVariable instead of what GNU Make calls "Special Built-in Target Names".

I was implementing a new rule for matching trailing whitespace after variables, and found that PHONY was being treated as a variable which was messing with how I was trying to match trailing comment patterns. So, I ended up refactoring the parser a bit. I noticed there are still some bugs with LineNumber being set off by 1 in some instances... Not sure why that is, and it's getting late so my brain's too tired to figure it out now.

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

3 participants