forcedotcom/sfdx-code-analyzer-vscode

[BUG]Unexpected end of JSON input

Closed this issue · 11 comments

Hi, I am getting a JSON error every time i run the code analyzer in VS code: " Unexpected end of JSON input", in all my salesforce projects

image

@LilianaRTSf , which command are you using, and what's the code you're running it against?

@LilianaRTSf , also, do you have a valid sfdx-project.json file in the root of your project?

Hello, I am using the sfdx menu, I select a class and click "SFDX: Scan selected files or folders with code analyzer" I also tried the "SFDX:Scan current file with code analyzer", I have a sfdx-project.json, I can connect to my org and retrieve-deploy

@LilianaRTSf , can you post the file that you're trying to scan? We're struggling to reproduce this on our end. Also, can you please indicate the following:

  • What version the Code Analyzer are you running (run sfdx plugins in the CLI and tell us what version it says for @salesforce/sfdx-scanner)
  • What OS are you using?

I am using v4.2.0, MacOs Sonoma 14.5

@LilianaRTSf , could you also please post the file you're trying to scan? We can't reproduce it locally, so it's possible it's something to do with your file.

@LilianaRTSf With VS Code open, can you please click on Help > "Toggle Developer Tools" which should reveal what looks like a chrome developer console window.

Then please do your repro steps and see what error messages appear in the console. Then paste those full error messages here please.

Additionally, have you tried to reproduce the issue with our CLI, specifically the sf scanner run command?

Hi, thank you all for your help, yesterday someone from my work helped me and I installed code analyzer via command line, also installed node and npm, to install a missing file called RetireJS, which was causing the error. Running Code Analyzer with the command line works fine (sf scanner run --normalize-severity --target force-app/main/default/classes/class.cls --outfile results2.html), but when I use the menu "SFDX: Scan selected files or folders with code analyzer" i get the error "[error] RetireJS: env: node: No such file or directory" but i already installed it
image

@LilianaRTSf , stupid question, but did you restart VSCode after you installed all of these things?

@LilianaRTSf We are unable to reproduce on our end. Is this still an issue with you after installing the latest CLI and VS Code Extension?

Closing this due to inactivity!