cflint / CFLint

Static code analysis for CFML (a linter)
BSD 3-Clause "New" or "Revised" License
174 stars 84 forks source link

Misc. Parsing Error? #54

Closed jerronjames closed 9 years ago

jerronjames commented 9 years ago

Misc Violation in CFLint-result:

Error   

  In file \TaskGateway.cfc, line 57
  In c:\v11\server\webapps\ROOT\WEB-      INF\railo\components\railo\extension\gateway\TaskGateway.cfc
  At line : 57
  Expression: [@209,1518:1521='file',<88>,57:56]

Function being parsed:

  23:     public function start() {
  24: 
  25:         while ( variables.state == "stopping" )
  26:             sleep( 10 );
  27: 
  28:         variables.state = "running";
  29: 
  30:         log text="Event Gateway #variables.id# started" file=this.logfile;
  31: 
  32:         while ( variables.state == "running" ) {
  33: 
  34:             try {
  35: 
  36:                 this.PerformTask();
  37:             }
  38:             catch ( ex ) {
  39: 
  40:                 log text="Event Gateway #variables.id# error: #ex.message#" file=this.logfile type="error";
  41:             }
  42: 
  43:             // sleep( variables.interval );
  44:             
  45:             var ts = getTickCount();
  46:             
  47:             while( getTickCount() - ts < variables.interval ) {
  48: 
  49:                 sleep( 1000 );
  50: 
  51:                 if ( variables.state != "running" )
  52:                     break;
  53:             }
  54:         }
  55: 
  56:         variables.state = "stopped";
  57:         log text="Event Gateway #variables.id# stopped" file=this.logfile;
  58:     }
ryaneberly commented 9 years ago

What is that crazy syntax?

     log text="Event Gateway #variables.id# started" file=this.logfile;

Can you point me it's documentation.

ryaneberly commented 9 years ago

found it: http://www.getrailo.org/index.cfm/whats-up/railo-40-released/features/tags-in-cfscript/

For a while now, Railo has had the ability to use most of the built-in tags within the <cfscript> tag. 
All you have to do is remove the <cf at the start and usually, if it is a single line replace the > at 
the end with ;....

How about tags that wrap some kind of content? Tags like <cfmail>, <cfloop> and <cfquery>? 
They are just as easily used with {} brackets!

Maybe just me, but seems an arbitrary way to make the language more complex. What is wrong with functions?

jerronjames commented 9 years ago

Oh, I should point out. That code is actually in the railo code base, not ours. I just thought I’d document it.

From: ryaneberly [mailto:notifications@github.com] Sent: Friday, May 15, 2015 6:14 AM To: cflint/CFLint Cc: Jerron James Subject: Re: [CFLint] Misc. Parsing Error? (#54)

found it: http://www.getrailo.org/index.cfm/whats-up/railo-40-released/features/tags-in-cfscript/

For a while now, Railo has had the ability to use most of the built-in tags within the tag.

All you have to do is remove the <cf at the start and usually, if it is a single line replace the > at

the end with ;....

How about tags that wrap some kind of content? Tags like , and ?

They are just as easily used with {} brackets!

Maybe just me, but seems an arbitrary way to make the language more complex. What is wrong with functions?

— Reply to this email directly or view it on GitHubhttps://github.com/cflint/CFLint/issues/54#issuecomment-102383827.

ryaneberly commented 9 years ago

https://wikidocs.adobe.com/wiki/display/coldfusionen/Tags#Tags-Tagwithoutbodies

ryaneberly commented 9 years ago

log is implemented, but there is a whole mess of tags to handle this way.

jjames967 commented 9 years ago

I'm wondering if there's a simple way to parse and flag them? Personally, I think they should be flagged critical to not use. However, the question remains... simple way to identify them?

ryaneberly commented 9 years ago

the same logic was used to define the cfscript version of cfcomponent

identifying them should be relatively simple. There's just a lot of busy work putting the keywords into the lexer. .

On Fri, May 15, 2015 at 11:17 PM, jjames967 notifications@github.com wrote:

I'm wondering if there's a simple way to parse and flag them? Personally, I think they should be flagged critical to not use. However, the question remains... simple way to identify them?

— Reply to this email directly or view it on GitHub https://github.com/cflint/CFLint/issues/54#issuecomment-102567297.

ryaneberly commented 9 years ago

fixed.