cflint / CFLint

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

Abstract component #736

Open boris-schwarz opened 3 months ago

boris-schwarz commented 3 months ago

Scenario

}


## Expected behaviour
CFLint should see no problems with this file.

## Effective behaviour
* CFLint gives me an error on line 1: `End of statement(;) expected after abstract`
* CFLint gives me an error on line 12: `End of statement(;) expected after function`
* CFLint gives me an error on line 12: `End of statement(;) expected after false` (This one is not visible in VS Code due being on the same line as the previous one. It can be seen by running CFLint manually, see below.)

## Possible workaround
* Remove `abstract` from the component during development. In my case this causes problems with depencendy injection tho.
* Rewrite all abstract components in the `cftag` syntax, where it works.

## Additional Information
* Windows 11
* Lucee 5.3.10.97
Generated JSON from running `CFLint-1.5.0-all.jar` directly on the file with `java -jar D:\CFLint\CFLint-1.5.0-all.jar -file D:\my-project\webroot\model\services\aFoo.cfc -json` in the Windows Terminal
```json
{
  "version" : "1.5.0",
  "timestamp" : 1715869816,
  "issues" : [ {
    "severity" : "ERROR",
    "id" : "MISSING_SEMI",
    "message" : "MISSING_SEMI",
    "category" : "CFLINT",
    "abbrev" : "MS",
    "locations" : [ {
      "file" : "D:\\my-project\\webroot\\model\\services\\aFoo.cfc",
      "fileName" : "aFoo.cfc",
      "function" : "",
      "offset" : 7,
      "column" : 7,
      "line" : 1,
      "message" : "End of statement(;) expected after abstract",
      "variable" : "abstract",
      "expression" : ""
    } ]
  }, {
    "severity" : "ERROR",
    "id" : "MISSING_SEMI",
    "message" : "MISSING_SEMI",
    "category" : "CFLINT",
    "abbrev" : "MS",
    "locations" : [ {
      "file" : "D:\\my-project\\webroot\\model\\services\\aFoo.cfc",
      "fileName" : "aFoo.cfc",
      "function" : "",
      "offset" : 261,
      "column" : 22,
      "line" : 12,
      "message" : "End of statement(;) expected after function",
      "variable" : "function",
      "expression" : ""
    } ]
  }, {
    "severity" : "ERROR",
    "id" : "MISSING_SEMI",
    "message" : "MISSING_SEMI",
    "category" : "CFLINT",
    "abbrev" : "MS",
    "locations" : [ {
      "file" : "D:\\my-project\\webroot\\model\\services\\aFoo.cfc",
      "fileName" : "aFoo.cfc",
      "function" : "",
      "offset" : 284,
      "column" : 45,
      "line" : 12,
      "message" : "End of statement(;) expected after false",
      "variable" : "false",
      "expression" : ""
    } ]
  } ],
  "counts" : {
    "totalFiles" : 1,
    "totalLines" : 18,
    "countByCode" : [ {
      "code" : "MISSING_SEMI",
      "count" : 3
    } ],
    "countBySeverity" : [ {
      "severity" : "ERROR",
      "count" : 3
    } ]
  }
}