forcedotcom / sfdx-code-analyzer-vscode

Salesforce Code Analyzer is a unified tool for source code analysis. Run Code Analyzer to scan multiple languages in your code and add diagnostic info to your code that describes the violations.
BSD 3-Clause "New" or "Revised" License
9 stars 1 forks source link

[BUG] [error] when scanning selected class #31

Closed GastonLopezz closed 11 months ago

GastonLopezz commented 11 months ago

Describe the bug A clear and concise description of what the bug is.

When I scan any class in my repo I see an "[error]" appearing.

To Reproduce Steps to reproduce the behavior:

Scan an apex class

Expected behavior A clear and concise description of what you expected to happen.

Display the warnings of the Apex classes

Screenshots If applicable, add screenshots to help explain your problem.

image image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

I just try to scan any Apex class and I get this error

"Workaround": Have you found any ways to sidestep the problem? No

"Urgency": How severe is this problem? "Business stopping" vs "Not business-stopping". Business stopping

jfeingold35 commented 11 months ago

@GastonLopezz , I'm unable to reproduce this error with the information you've provided. Can you please fill out the requested information, including what version of the Scanner and Extension you have installed?

GastonLopezz commented 11 months ago

@GastonLopezz , I'm unable to reproduce this error with the information you've provided. Can you please fill out the requested information, including what version of the Scanner and Extension you have installed?

Hi @jfeingold35, thanks for your quick response! I filled the requested information with some details of the error, hope this works for you. There is not many more to add because the error appears when I just try to scan an Apex Class no matter which it is.

Thanks in advance!

jfeingold35 commented 11 months ago

@GastonLopezz , the "scanner version" field should be the version of SFDX scanner that you have installed. In a CLI terminal, run sf plugins and let me know what it says for the @salesforce/sfdx-scanner entry.

GastonLopezz commented 11 months ago

@jfeingold35 Sorry for the confusion, it is already updated. Regards

jfeingold35 commented 11 months ago

@GastonLopezz , okay, those are the versions I'm running locally and I'm not seeing that error. Can you please tell me which option you're using to start the scan? ("Scan current file..." or "Scan selected method with Graph Engine"?)

GastonLopezz commented 11 months ago

"Scan current file..."

jfeingold35 commented 11 months ago

@GastonLopezz , I'm still unable to reproduce. Have you tried the following:

  1. Updating the scanner to v3.19.0 (we just released that a few days ago).
  2. Running against an absurdly simple Apex class, perhaps one that has only two methods and they both return true?
GastonLopezz commented 11 months ago

@jfeingold35 I get this when I tried to update it

image

I also tried creating a Test class with a simple method that returns a boolean and the same issue happened

jfeingold35 commented 11 months ago

@GastonLopezz , I've never seen that error before, and our project doesn't seem to have a dependency on @salesforce/lwc-dev-server. So I'm not sure where that error could be coming from. But it does seem like it might be related to the mysterious error you're seeing in VSCode.

Could you please try one more thing for me? What happens if you run the scanner plugin directly through the CLI (via sf scanner run) instead of through the VSCode command? Does that return results, or does it also error out?

GastonLopezz commented 11 months ago

Hi @jfeingold35 I could make salesforce scanner work after uninstalling all the plugins that were causing warnings (including lwc-dev-server, looks like this one was blocking the scanner).

Thanks for your help!