mrtazz / checkmake

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

bug: Line number is not displayed correctly for minphony #29

Closed Kreyren closed 4 years ago

Kreyren commented 4 years ago
image

Expected behaviour

Suggest correct line 155 for conflicting minphony

Actual behaviour

Conflicting line is 155 where line number 0 is suggested:

Output of checkmake --version

gitpod /workspace/Kreyrock $ checkmake --version
checkmake  built at  by  with 

Using commit https://github.com/mrtazz/checkmake/commit/03dd76b964dd2cf535a7e1f0efe5731c183a3071

Output of checkmake --debug <your makefile>

https://gist.githubusercontent.com/Kreyren/03329ef4dd8c6b35152ca49cb93a27f7/raw/66f97f8c0acc21798a81b98f68f0e3a8e37ca4b2/gistfile1.txt

Output of make --version

gitpod /workspace/Kreyrock $ make --version
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redist

Sample Makefile to reproduce issue

https://gist.githubusercontent.com/Kreyren/788b99fc6a926fe1f7503b034c2b40f8/raw/3f8ebccd9557b348600a0987e8dc86292167157d/gistfile1.txt

ghost commented 4 years ago

If I run it on the Makefile from the docker branch it also seems to report the incorrect line number, it gives the line number from the next command instead of the one that had a bug.

      RULE                 DESCRIPTION             LINE NUMBER  

  phonydeclared   Target "binaries" should be      58           
                  declared PHONY.                               
  maxbodylength   Target body for "coverage"       72           
                  exceeds allowed length of 5                   
                  (8).