Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkstyle not working with visual studio 1.43.0 on Mac #274

Open
getaceres opened this issue Mar 18, 2020 · 9 comments
Open

Checkstyle not working with visual studio 1.43.0 on Mac #274

getaceres opened this issue Mar 18, 2020 · 9 comments

Comments

@getaceres
Copy link

I'm using the following environment:

Visual Studio Code 1.43.0 on MacOS Catalina
Java Support 0.58.0
Checkstyle Plugin 1.3.0

When I execute the command "Set the checkstyle configuration file" I get a notification saying
"Successfully set the Checkstyle configuration." but nothing changes in the editor and in the output of the plug in I see the following message:

"Checkstyle configuration file not set yet, skip the check."

No matter what file I select. I tried with the built in /google_checks.xml and /sun_checks.xml and also with https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml but the result is the same. This message and the checkstyle rules are not applied. I don't see any checkstyle error in any file editor and if I select the command "Check code with checkstyle" nothing happens.

@rafaelrenanpacheco
Copy link

Same here. I'm using:

Visual Studio Code 1.43.2 on Arch Linux
Java Support 0.58.0
Checkstyle Plugin 1.3.2

After I set the checkstyle configuration file, it created a new .vscode folder with a settings.json file. Shouldn't it use the user settings file, located on the ~./.config/Code/User folder?

@rafaelrenanpacheco
Copy link

Found the problem, the extension was using the wrong checkstyle version. After I set it to 8.30 it started working:

image

I also removed the .vscode folder and set the ${workspaceFolder}/checkstyle.xml on the user's setting file.

@getaceres
Copy link
Author

I just tested in Arch Linux as well and setting it to 8.30 with the embedded google_checks.xml file doesn't do anything. ¿What local checkstyle.xml file are you using?

@rafaelrenanpacheco
Copy link

I'm using a custom checkstyle. Make sure that mvn checkstyle:check is working as well. Also make sure that you are using the same checkstyle version as defined in your pom.xml file.

@jdneo
Copy link
Owner

jdneo commented Apr 2, 2020

@getaceres Could you share a sample project to us?

@getaceres
Copy link
Author

Sure, for example this simple project:

https://github.com/getaceres/webflux-simple-demo

executing mvn clean install will find several checkstyle violations while VSCode finds none.

@rslarson
Copy link

On Mac, I observed you have to use the full path to point to the XML as ${workspaceFolder} does not seem to actually resolve to anything.

@lambainsaan
Copy link

Found the problem, the extension was using the wrong checkstyle version. After I set it to 8.30 it started working:

image

I also removed the .vscode folder and set the ${workspaceFolder}/checkstyle.xml on the user's setting file.

+1, This worked for me!

@Keetz
Copy link

Keetz commented Jun 11, 2021

Ubuntu 20.04.2 LTS
VSCode 1.57.0
Checkstyle 1.4.0

I am having this exact problem.
No matter which checkstyle file I try to set, it just gives the: Checkstyle configuration file not set yet, skip the check.

Although, if I try to set it in the user or workspace settings I get the following error:

Error: Running the contributed command: 'java.execute.workspaceCommand' failed. at _executeContributedCommand (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:84:108254) at async Object.sendPendingDiagnostics (/home/<MY_USER>/.vscode/extensions/shengchen.vscode-checkstyle-1.4.0/dist/extension.js:1:87630)

UPDATE
I spent some more time trying different settings and I found one that worked. I am not sure what works and what doesn't, but the following worked for me:

  1. Remove all checkstyle settings from user settings, workspace settings and project settings (.vscode folder in project)
  2. Only add the settings to the workspace settings. I am using "java.checkstyle.version": "8.41", and "java.checkstyle.configuration": "/home/<MY_USER>/.vscode/checkstyle.xml",

If I try to use a version beyong 8.41 I get the following error:

Error: Running the contributed command: 'java.execute.workspaceCommand' failed.
	at _executeContributedCommand (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:84:108251)
	at async Object.sendPendingDiagnostics (/home/<MY_USER>/.vscode/extensions/shengchen.vscode-checkstyle-1.4.0/dist/extension.js:1:87630)

I don't know if this is because of some changes to the actual checkstyle format in 8.42 and beyond or if it is this plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants