eclipse-cs icon indicating copy to clipboard operation
eclipse-cs copied to clipboard

Add "Check style of active document after every save" preference

Open olivarre opened this issue 7 years ago • 4 comments

When projects are very large, you might not want to enable automatic building or perform a full build on your project just to CheckStyle a single file you're working on.

With this preference enabled, saving the active document triggers a CheckStyle on it regardless of build settings. The result is you can rapidly re-check and fix CheckStyle issues rather than use the menu commands over and over.

I have the code working and will commit if this issue is accepted.

olivarre avatar Aug 28 '18 02:08 olivarre

The eclipse autobuild feature only incrementally builds changed resources. Up until now this has worked quite well, in my opinion.

You are proposing an additional means of automatically checking files on save, when autobuild is disabled. Can you make a stronger case how this would integrate with the current solution in typical scenarions (autobuild active etc)? I am especially interested how this should be presented and communicated to the majority of users without confusing them.

lkoe avatar Aug 28 '18 05:08 lkoe

I'm also in favor of rejecting this. The problem here is not that checkstyle is not invoked automatically anymore, but that the automatic build is disabled. And if that was done due to some other builder taking a lot of time for incremental builds, then that other builder should be fixed, instead of adding a work around to every other plugin.

Bananeweizen avatar Oct 30 '18 15:10 Bananeweizen

The eclipse autobuild feature only incrementally builds changed resources

unfortunately this is not always right, after checkstyle version update, sources are the same, they even can be in cache of checkstyle but binaries are different and behavior might be different. I have never chased a root reason why Eclipse-cs missing some violations, but CI do detect them. So idea to run checkstyle validation on all opened files might be interesting, but still when to trigger validation ? on file open in Editor?

@olivarre , please share details on your ideas. Users do use IDE in diffent ways as projects are so different, so real user-story is good to know , but we need details.

romani avatar Oct 31 '18 00:10 romani

Version changes of the EclipseCS plugin are yet another different story. The solution for that would be:

  • When running any EclipseCS analysis, store the current version number in the meta data of the workspace.
  • When starting an Eclipse workbench, read that stored version number and compare it to the current version of the EclipseCS plugin.
  • If both are different, trigger a full rebuild of all projects, which are enabled for Checkstyle.

The Java plugin does the same and rebuilds everything after it was upgraded.

Bananeweizen avatar Oct 31 '18 04:10 Bananeweizen

I'm regularly using the plugin on workspaces with millions of lines of code in them. There is no performance problem with the automatic build enabled, because both the Java tooling as well as the Checkstyle plugin work incremental. So after everything has been built one time, the plugin will check only modified files. As of now, without any additional settings.

Bananeweizen avatar Sep 21 '23 14:09 Bananeweizen