til

How to configure VSCode with untrusted certificate

sonarqubevscode

I always forget the formula so here are the steps:

First, download the certificate from the domain using Chrome or Firefox.

Next, import the certificate in the Java VM Keytool:

sudo keytool -import -alias whatever_alias -keystore /Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home/lib/security/cacerts -file path/to/certificate.cer

In VSCode I also had to add the path to my JVM installation In VSCode Settings > Sonarlint › Ls: Java Home. At the time or writing the value is /Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home

To use the connected mode I add this piece of JSON to .vscode/settings.json

"sonarlint.connectedMode.project": {
  "projectKey": "CODE_PROJECT_HERE"
}

After restarting VSCode it should be in connected mode.