Linter-checkstyle-java


#1

http://checkstyle.sourceforge.net/ can be configured to Google Java Style and Sun Code Conventions.
It has a CLI in the form of a java jar file.

There isn’t enough documentation to ease a person into writing a linter-package for atom. Any guidelines/suggestions?


#2

There is a linter-checkstyle package available, from Sebastian Szturo.
I have been unsuccessful in trying to install it.
It actually appears to be installed but is not available on the Packages menu and is not working.


#3

Is there a linter-checkstyle/ folder under .atom/packages/ in your user directory? If so, does it contain anything? If not, what happens when you open a command line and enter apm install linter-checkstyle?


#4

There is a linter-checkstyle/ folder with three subfolders: data, lib and node-modules, and 4 files.

apm install linter-checkstyle
Installing linter-checkstyle to C:\Users\Michael.atom\packages done

Is it supposed to show up on the Packages menu?


#5

No, because the Packages menu only shows packages that have registered dropdown menu entries (linter-checkstyle has not because there’s no menu/ folder in the package source).

Is it not showing up on the Packages tab under Settings?


#6

Yes, it is showing up there.
So how do I ask it to check a file?


#7

linter-checkstyle is a provider package for the linter package. If you have either linter or atom-ide-ui installed and enabled, linter-checkstyle should be activated automatically whenever you have a Java file open.


#8

That is not happening, so I’m guessing it must be in the settings.

‘linter-checkstyle’:

The path to checkstyle. The default (checkstyle) should work as long as you have it

in your system PATH.

‘checkstyleExecutablePath’: “checkstyle”

Check configuration file to use when executing checkstyle.

‘checkConfiguration’: ‘’

I put the checkstyle-8-8-all.jar file in a directory in my system PATH, but that must not be what this instruction means.


#9

So that got formatted strangely when I pasted in the text from the Setting and it got interpreted as mrkdown.


#10

Okay, so this is a question of how Atom is going to access checkstyle. Atom has the ability to issue shell commands via Node.js, which is exposed for package developers as the BufferedProcess API. linter refers to the active provider (based on the file’s grammar) to find out what command needs to be used, and then it executes the command and interprets the results according to how the provider says they should be interpreted. In order for Atom to be able to talk to checkstyle, you need to make it so that you can open a command line and type checkstyle and get a response.

I don’t have any experience here, so all I can go on is the documentation. I see that checkstyle comes as a .jar file. Given that the settings for the package specifically mention an executable, I’m guessing that it isn’t set up to run from the .jar file (which is confirmed with a quick scan of the provider’s code). Based on that, your next step should be to compile checkstyle.


#11

I’ve come a bit closer. I created a “checkstyle.bat” file in the System path with the line

java -jar C:\Users\Michael\AppData\Local\atom\bin\checkstyle-8.8-all.jar -c /google_checks.xml %*

Now Atom displays the number of linter warnings but not what they are.


#12

Maybe the package maintainer could help you. You can try to contact them through an issue on the GitHub repo.


#13

Thank you for all the suggestions. I decided to separate editor from these linters/checkers, which makes life a lot easier.


#14

Thanks. I have posted an issue on the GitHub repo.