jbenden / vscode-c-cpp-flylint

A VS Code extension for advanced, modern, static analysis of C/C++ that supports a number of back-end analyzer programs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PC-Lint Messages not able to generate in "Problem" Column

Vishal-Gaikwad opened this issue · comments

I have sample C++ program with memory leak issue to detect. I am unable to see PC-Lint Plus error messages in "PROBLEM" window of VSCode but able to see the output messages on "OUTPUT" window.

Here is the configuration setting i am using:

{
    "window.zoomLevel": 1,
    "c-cpp-flylint.debug": true,
    "c-cpp-flylint.language": "c++",
    "c-cpp-flylint.clang.blocks": false,
    "c-cpp-flylint.clang.enable": false,
    "c-cpp-flylint.lizard.enable": false,
    "c-cpp-flylint.flexelint.enable": false,
    "c-cpp-flylint.flawfinder.enable": false,
    "c-cpp-flylint.cppcheck.enable": true,
    "c-cpp-flylint.pclintplus.enable": true,
    "c-cpp-flylint.pclintplus.executable": "D:\\PC-Lint\\windows\\pclp64.exe",
    "c-cpp-flylint.pclintplus.configFile": "D:\\PC-Lint\\windows\\lnt\\linter.lnt",
    "c-cpp-flylint.pclintplus.severityLevels": {
        "error": "Error",
        "warning": "Warning",
        "info": "Information",
        "note": "Hint"
      }
}

The error i am getting is as below:
vscode-c-cpp-flylint: 'The diagnostic code undefined was neither a number nor string!' while validating: d:\SonarQube\Linter\VSCode\FirstProgram\HelloWorld.cpp. Please analyze the 'C/C++ FlyLint' Output console. Stacktrace: TypeError: The diagnostic code undefined was neither a number nor string! at Object.from (c:\Users\z0042k0v\.vscode\extensions\jbenden.c-cpp-flylint-1.11.0\server\out\server.js:2:28004) at c.getSeverityCode (c:\Users\z0042k0v\.vscode\extensions\jbenden.c-cpp-flylint-1.11.0\server\out\server.js:2:17629) at c.parseLine (c:\Users\z0042k0v\.vscode\extensions\jbenden.c-cpp-flylint-1.11.0\server\out\server.js:2:16880) at c:\Users\z0042k0v\.vscode\extensions\jbenden.c-cpp-flylint-1.11.0\server\out\server.js:2:13622 at Array.forEach (<anonymous>) at c.parseLines (c:\Users\z0042k0v\.vscode\extensions\jbenden.c-cpp-flylint-1.11.0\server\out\server.js:2:13492) at c.lint (c:\Users\z0042k0v\.vscode\extensions\jbenden.c-cpp-flylint-1.11.0\server\out\se...

PCLintPlus_ParsingIssue

Could anyone please guide me what's the issue here?

I have the same problem, has your problem been solved?

Hello!

I also have this problem right now.

Here is my setup:

  • VSCode 1.85.2
  • FlyLint 1.13.1
  • PClint Plus 1.4.1 on a windows machine

The error message in VSCode:

'The diagnostic code undefined was neither a number nor string!' while validating: c:\Users\[<user_home>]\[<path_to_source>]\test.c. Please analyze the 'C/C++ FlyLint' Output console. Stacktrace: TypeError: The diagnostic code undefined was neither a number nor string!
    at Object.from (c:\Users\[<user_home>]\.vscode\extensions\jbenden.c-cpp-flylint-1.13.1\server\out\server.js:2:26215)
    at c.getSeverityCode (c:\Users\[<user_home>]\.vscode\extensions\jbenden.c-cpp-flylint-1.13.1\server\out\server.js:2:16359)
    at c.parseLine (c:\Users\[<user_home>]\.vscode\extensions\jbenden.c-cpp-flylint-1.13.1\server\out\server.js:2:15627)
    at c:\Users\[<user_home>]\.vscode\extensions\jbenden.c-cpp-flylint-1.13.1\server\out\server.js:2:12574
    at Array.forEach (<anonymous>)
    at c.parseLines (c:\Users\[<user_home>]\.vscode\extensions\jbenden.c-cpp-flylint-1.13.1\server\out\server.js:2:12438)
    at c.lint (c:\Users\[<user_home>]\.vscode\extensions\jbenden.c-cpp-flylint-1.13.1\server\out\server.js:2:12341)
    at c:\Users\[<user_home>]\.vscode\extensions\jbenden.c-cpp-flylint-1.13.1\server\out\server.js:2:21825
    at Array.forEach (<anonymous>)
    at B (c:\Users\[<user_home>]\.vscode\extensions\jbenden.c-cpp-flylint-1.13.1\server\out\server.js:2:21800)

And the output of the debug window:

c:\Users\[<user_home>]\[<path_to_source>]\test.c is currently version number 34 and 28 was already been scanned.
c:\Users\[<user_home>]\[<path_to_source>]\test.c force = false.
c:\Users\[<user_home>]\[<path_to_source>]\test.c is now at version number 34.
Performing lint scan of c:\Users\[<user_home>]\[<path_to_source>]\test.c...
executing:  C:\opt\pclp-1.4.1\bin\pclp64.EXE c:\Users\[<user_home>]\[<path_to_cfg>]\.pclint.lnt -v -b -format=%f  %l %c  %t %n: %m -h1 -width(0,0) -zero(400) c:/Users/[<user_home>]/[<path_to_source>]/test.c
[
  "c:\\Users\\[<user_home>]\\[<path_to_source>]\\test.c  8 11  info 838: previous value assigned to 'retVal' not used",
  'c:\\Users\\[<user_home>]\\[<path_to_source>]\\test.c  7 8  supplemental 891: previous assignment is here',
  "c:\\Users\\[<user_home>]\\[<path_to_source>]\\test.c  3 4  info 714: external symbol 'test' was defined but not referenced",
  "c:\\Users\\[<user_home>]\\[<path_to_source>]\\test.c  3 4  info 765: external symbol 'test' could be made static",
  ''
]
[ '' ]
Completed lint scans...
c:\Users\[<user_home>]\[<path_to_source>]\test.c is currently version number 34 and 34 was already been scanned.
Skipping scan of c:\Users\[<user_home>]\[<path_to_source>]\test.c because this file version number 34 has already been scanned.

This is my configuration of FlyLint in VSCode settings:

{
    "c-cpp-flylint.clang.enable": false,
    "c-cpp-flylint.cppcheck.enable": false,
    "c-cpp-flylint.flexelint.enable": false,
    "c-cpp-flylint.lizard.enable": false,
    "c-cpp-flylint.flawfinder.enable": false,
    "c-cpp-flylint.pclintplus.enable": true,
    "c-cpp-flylint.pclintplus.executable": "pclp64",
    "c-cpp-flylint.debug": true,
    "c-cpp-flylint.language": "c",
    "c-cpp-flylint.standard": [
        "c99"
    ],
    "c-cpp-flylint.includePaths": [
        ".",
        "./zlib",
        "./popt"
    ],
    "c-cpp-flylint.defines": [
        "NDEBUG",
        "HAVE_CONFIG_H"
    ],
    "c-cpp-flylint.run": "onType"
}

Can someone give me a hint, how this issue can be solved?

My problem has been solved and I submitted a PR, but the latest version hasn't been released yet and I'm not sure ours is the same problem.
Here is the link where I submitted the PR:

#212

Be sure there are no spaces in filenames; as that will cause problems. Shy of that, I do not have a license for the software to run testing with. Therefore, someone with one will need to triage this bug report.

jbenden.c-cpp-flylint v1.14.0

Case 1:

int main() {
    float a = 1;
    while (true) { }
}

Output:

Performing lint scan of <myproject_dir>\source\startup\main.cpp...
executing:  <pclint_dir>\windows\pclp64_debug.exe <myproject_dir>/source/project.lnt -v -b -format=%f  %l %c  %t %n: %m -h1 -width(0,0) -zero(400) <myproject_dir>/source/startup/main.cpp
[
  "<myproject_dir>\\source\\startup\\main.cpp  2 4  note 970: use of modifier or type 'float' outside of a typedef",
  '<myproject_dir>\\source\\startup\\main.cpp  4 1  info 783: line does not end with a newline',
  "<myproject_dir>\\source\\startup\\main.cpp  4 0  warning 438: last value assigned to 'a' not used",
  '<myproject_dir>\\source\\startup\\main.cpp  2 10  supplemental 891: previous assignment is here',
  "<myproject_dir>\\source\\startup\\main.cpp  2 14  note 915: implicit arithmetic conversion (initialization) from 'int' to 'float'",
  '<myproject_dir>\\source\\startup\\main.cpp  2 14  note 9115: implicit conversion from integer to floating point type',
  '<myproject_dir>\\source\\startup\\main.cpp  3 11  info 716: infinite loop via while',
  "<myproject_dir>\\source\\startup\\main.cpp  2 10  warning 529: local variable 'a' declared in 'main' not subsequently referenced",
  '  0 0  note 900: execution completed producing 7 primary and 1 supplemental messages (8 total) after processing 1 module',
  ''
]
[ '' ]
Completed lint scans...

Tooltip:

'The diagnostic code undefined was neither a number nor string!' while validating: <myproject_dir>\source\startup\main.cpp. Please analyze the 'C/C++ FlyLint' Output console. Stacktrace: TypeError: The diagnostic code undefined was neither a number nor string!
    at Object.from (<vscode_dir>\ext\jbenden.c-cpp-flylint-1.14.0\server\out\server.js:2:26287)
    at c.getSeverityCode (<vscode_dir>\ext\jbenden.c-cpp-flylint-1.14.0\server\out\server.js:2:16431)
    at c.parseLine (<vscode_dir>\ext\jbenden.c-cpp-flylint-1.14.0\server\out\server.js:2:15699)
    at <vscode_dir>\ext\jbenden.c-cpp-flylint-1.14.0\server\out\server.js:2:12591
    at Array.forEach (<anonymous>)
    at c.parseLines (<vscode_dir>\ext\jbenden.c-cpp-flylint-1.14.0\server\out\server.js:2:12455)
    at c.lint (<vscode_dir>\ext\jbenden.c-cpp-flylint-1.14.0\server\out\server.js:2:12358)
    at <vscode_dir>\ext\jbenden.c-cpp-flylint-1.14.0\server\out\server.js:2:21897
    at Array.forEach (<anonymous>)
    at B (<vscode_dir>\ext\jbenden.c-cpp-flylint-1.14.0\server\out\server.js:2:21872)

Problem's tab is empty.


Case 2:

int main() {
    while (true) { }
}

Output:

Performing lint scan of <myproject_dir>\source\startup\main.cpp...
executing:  <pclint_dir>\windows\pclp64_debug.exe <myproject_dir>/source/project.lnt -v -b -format=%f  %l %c  %t %n: %m -h1 -width(0,0) -zero(400) <myproject_dir>/source/startup/main.cpp
[
  '<myproject_dir>\\source\\startup\\main.cpp  3 1  info 783: line does not end with a newline',
  '<myproject_dir>\\source\\startup\\main.cpp  2 11  info 716: infinite loop via while',
  '  0 0  note 900: execution completed producing 2 primary and 0 supplemental messages (2 total) after processing 1 module',
  ''
]
[ '' ]
Completed lint scans...

No tooltip.

Problem's tab filled with 2 strings:

infinite loop via while PclintPlus (c-cpp-flylint)(716) [Ln 2, Col 5]
line does not end with a newline PclintPlus (c-cpp-flylint)(783) [Ln 3, Col 1]

Its failed on getSeverityCode() with supplemental argument.


    private getSeverityCode(severity: string): DiagnosticSeverity {
        console.log("this.settings: ");
        console.log(this.settings);
        let output = this.settings.pclintplus.severityLevels[severity as keyof PclintPlusSeverityMaps];
        return VS_DiagnosticSeverity.from(output);
    }
this.settings: 
{
  enable: true,
  debug: true,
  .............
  pclintplus: {
    enable: true,
    executable: '<pclint_dir>/windows/pclp64_debug.exe',
    configFile: '<myproject_dir>/source/project.lnt',
    headerArgs: [],
    severityLevels: {
      error: 'Error',
      warning: 'Warning',
      info: 'Information',
      note: 'Hint'
    }
  },
  .............

Supplemental is missing.


Fix Workaround:
add in settings.json

"c-cpp-flylint.pclintplus.severityLevels": {
  "error": "Error",
  "warning": "Warning",
  "info": "Information",
  "note": "Hint",
  "supplemental": "Hint"
}

Issue #216