Donate Share

Eclipse Checkstyle Plug-in

Tracker: Patches

5 Choose a default global check for non-checkstyle projects - ID: 1832706
Last Update: Comment added ( kappert )

I would like to suggest a patch so users can choose the preferred
Checkstyle configuration to be used when checking projects that do not have
a .checkstyle file.

Motivation:
In our (huge) team we used Checkstyle half-heartedly. But it was not
enforceable (too many errors :-). So it was dropped. I still want to use
it, but I got tired of having the CVS projects flagged as modified just
because I want to run Checkstyle (the .checkstyle file). And if I do not
specify a check configuration for a project I am stuck with the built-in
Sun Checks configuration, which finds thousands of problems on our average
projects.

What the patch does:
It is strictly limited to the global configurations. It does not affect
local check configurations of a project (you have excellent flexibilty if
you are free to use a .checkstyle file in your projects).
A checkbox "Use when checking projects without local Check Configurations"
was added to the properties dialogs for internal, external and remote
configurations (not for the others). If you mark one of your configurations
with this checkbox as the preferred one it will be used in place of the
built-in Sun Checks when doing an "on-the-fly" check of a project that does
not have a .checkstyle file. The big advantage: You can modify the
behaviour of your preferred check, which is not possible for the built-in
Sun Checks.

The patch should work against version 4.3.3 of project CheckstylePlugin as
it was available in CVS around the time of this posting (November 14 2007).
[I did not find any CVS tags?]

German translation is included, French is missing.

If you do not like my modifications to the code you may want to consider
implementing such a feature in a later version. Although it may not be a
common situation, I find it useful to have my own global check
configuration that I can quickly run against any project.


Beat Kappert ( kappert ) - 2007-11-15 19:32

5

Closed

Fixed

Lars Koedderitzsch

None

None

Public


Comments ( 10 )

Date: 2007-12-17 16:39
Sender: kappert


Awesome, thanks a lot for your work!!!! I am very happy that my feature
request is now part of the Eclipse Checkstyle Plug-in. The solution with a
single reference "default-check-configuration" is clearly better than my
suggested patch. Simpler and yet more powerful - a good definition for
"better" :-)

I would _love_ to contribute more to projects like this, but unfortunately
just do not have the time to commit myself to such a task.



Date: 2007-12-15 13:36
Sender: lkoeProject Admin


Thank you very much (again) for your great contribution.
I applied to patch and committed the feature to CVS.

I changed a few small things:
- The default status is not stored with the single Check Configuration,
but as a simple reference to a Check Configuration in the Global Check
Configuration Working Set. This allows to manually choose the default for
Built-In Configurations too (e.g. from Sun Checks to Sun Checks (Eclipse))
- I changed the wording of the default button tooltip a bit

Again, thank you very much for your work and your top quality
contribution. I would be happy to see more of it - maybe you have even
interest to join in as a developer?

Best regards,
Lars Ködderitzsch


Date: 2007-12-14 19:41
Sender: kappert


I18n always tends to be forgotten :-)
German is included, but French is missing. Concerned are:
CheckstylePreferencePage_btnDefault
CheckstylePreferencePage_txtDefault
CheckstylePreferencePage_colDefault



Date: 2007-12-14 19:37
Sender: kappert


I have added a new version of the originally suggested patch. The new
patch is called Checkstyle_defaultGlobalConfig_patch.txt (old one was
Checkstyle_preferredGlobalConfig_patch.txt). The new patch completely
replaces the old one and can be applied to the project CheckstylePlugin as
it was available in CVS around the time of this posting (December 14
2007).
The new patch requires an icon tick.gif. This is not included in the patch
(binary files don't work it seems). It must be placed in the folder
"icons".

This is a better solution than the first version. Please feel free to
change anything you want. It would be great if the feature makes it into
CVS.


Date: 2007-12-14 19:31
Sender: kappert


File Added: tick.gif


Date: 2007-12-14 19:29
Sender: kappert


File Added: Checkstyle_defaultGlobalConfig_patch.txt


Date: 2007-11-23 13:34
Sender: kappert


This is a good idea! If the table remains read-only I think I can do it
myself without spending too much time with SWT details. I also do not have
a lot of time, but I will post the results here as soon as I have them.
Thanks for your help!


Date: 2007-11-21 18:47
Sender: lkoeProject Admin


Currently I am pretty stuffed with my regular project work, and christmas
is looming too. This means I currently don't know when I'd be able to work
on this.

If you would like to work further on this I'd be very happy.

I don't think the proposed additional column needs to be editable, it is
sufficient when it just shows if a config is default or not.
To change the default status I'd just add a button to the button bar which
sets the currently selected configuration to default.

Please drop me a short note if you would like to work further on the
patch, if not no problem, I'd then take over when I find some time.


Date: 2007-11-18 09:14
Sender: kappert


Hello Lars

Thank you very much for your appreciation and encouragement!

I absolutely agree on the usability issue (hidden change to other
configuration), this is not picky at all. In fact I had first experimented
with a ComboBox for choosing the preferred/default configuration on the
checkstyle preferences page. I gave up on it when I realized that updating
the contents of the ComboBox would be complicated when configurations would
be added/modified/removed. I also came to the conclusion that the natural
thing to do would be to add a column to the table of configurations. But I
was not sure if this table had to remain read-only for some reason. And I
also simply lack the skills - this is the first time I see SWT code :-)

So I support your option 2. With the excellent editing options for a
single configuration I do not see much need for combining configurations as
would be the case with option 1.

Do you think you will find the time to make this change? If not: Would
adding an editable column to the table have a lot of consequences?

BTW: Feel free to change my patch in any way you like. I tried to choose
names that would make sense, but somebody familiar with the code base can
make better choices.

If Checkstyle somehow provides a way to verify a non-Checkstyle project
with an editable configuration of my choice then I am a happy man :-) How
that goal is achieved is secondary.

Best regards
Beat

P.S: Maybe you could remove my posting "Default check for non-checkstyle
projects" in the Open Discussion forum. It is highly redundant :-)


Date: 2007-11-16 21:39
Sender: lkoeProject Admin


Hello Beat,

I think this proposed new feature is a fantastic addition. I am quite
impressed how good you found your way around in the plugins sources to
achieve this feature.
Thank you very much for this idea and your great patch.

I am nearly ready to accept this patch, I just have one (minor) usability
issue with your solution.
You added the new "preferred" option to the check configurations
properties dialog. Since there is just one preferred option you disable the
preferred option on the previous preferred check configuration.
From a usability standpoint this is a bit unexpected, as you influence a
second check configuration from within the properties of another
configuration. This influence on the second configuration is at this point
invisible to the user.

Two possible solutions to this (admittedly minor) problem come into my
mind:

1. Allow more than one "preferred" check configuration. In case of an
unconfigured project all "preferred" configurations would be used
2. Move the option to set the preferred/default configuration from the
properties dialog into the main Checkstyle preferences page, for instance
add a new column to the table of Check configurations and have a single
button on the right hand side button bar to set the selected check config
to preferred/default

I am leaning more to option 2, since the effect on both affected check
configuration (previous/new default config) is immediatly visible. Option 1
is a bit over the top since I don't think that any user would opt to have
more than one default config to check unconfigured projects with.

What do you think?

Regards,
Lars Ködderitzsch

PS: Please take no offence in me being so picky...


Attached Files ( 3 )

Filename Description Download
Checkstyle_preferredGlobalConfig_patch.txt Patch for project CheckstylePlugin (4.3.3), let's you choose a preferred global configuration when checking projects without a .checkstyle file. Download
Checkstyle_defaultGlobalConfig_patch.txt Patch to be applied to project CheckstylePlugin, implements selection of default global checkstyle configuration in table. Download
tick.gif Icon required in addition to Checkstyle_defaultGlobalConfig_patch.txt. Put in CheckstylePlugin/icons Download

Changes ( 7 )

Field Old Value Date By
status_id Open 2007-12-15 13:36 lkoe
resolution_id None 2007-12-15 13:36 lkoe
assigned_to nobody 2007-12-15 13:36 lkoe
close_date - 2007-12-15 13:36 lkoe
File Added 258616: tick.gif 2007-12-14 19:31 kappert
File Added 258615: Checkstyle_defaultGlobalConfig_patch.txt 2007-12-14 19:29 kappert
File Added 254477: Checkstyle_preferredGlobalConfig_patch.txt 2007-11-15 19:32 kappert