Incorrect error in line 0 when CFML parsing encounters cfscript-like not-equals
See original GitHub issueWhen scanning the following piece of code:
<cfif "foo" <> "bar">Foo</cfif>
The <>
triggers a parsing error (which might be an issue in itself – I’m not sure if today’s standards allow script-like use of comparators in CFML; Update: the code does work correctly on Railo 4.2.), which erroneously appears twice in the report output, once correctly with reported line 1, once incorrectly with line 0:
$ java -jar CFLint-0.11.1-all.jar -file cfml-test.cfm -text
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
line 1:7 no viable alternative at input '"foo"<'
Error in: <cfif "foo" <> "bar">Foo</cfif> @ 1:
expression is null, parsing error
Issue
Severity:ERROR
Message code:PARSE_ERROR
File:C:\Inbox\cflint-test\cfml-test.cfm
Column:8
Line:1
Message:Unable to parse
Variable:'null' in function:
Expression:no viable alternative at input '"foo"<'
Severity:ERROR
Message code:PARSE_ERROR
File:C:\Inbox\cflint-test\cfml-test.cfm
Column:0
Line:0
Message:Unable to parse
Variable:'null' in function: null
Expression:
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
CFLint/CHANGELOG.md at master - GitHub
Static code analysis for CFML (a linter). ... Incorrect error in line 0 when CFML parsing encounters cfscript-like not-equals #230 ...
Read more >Troubleshooting common problems - Adobe Support
CFML syntax errors. Problem: You get an error message such as the following: Encountered "function or tag name" at line 12, column 1....
Read more >Glitch in ColdFusion's CFML parser - Adam Cameron's Dev Blog
Adam Cameron is surprised to see ColdFusion doesn't require commas between function arguments. Sometimes.
Read more >Invalid token '\n' found on line 31 at column 0 - Stack Overflow
The error is slightly misleading. The CF compiler is trying to parse the code but failing because of a unclosed tag / block...
Read more >Invalid token '\n' found on line 452 at column 0
An invalid token error get thrown when ColdFusion is trying to finish parsing a TAG and either runs out of data (such as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That helps. I agree that the 2nd parsing error should not occur. it is fixed.
I’m fine if this triggers a
PARSE_ERROR
, but can we have just 1 such error reported and on a valid line? In other words: can we remove the one reported for “line 0”? 😃 We’re feeding these results into SonarQube and this fails now because SonarQube (rightly) reports an invalid line number.