martes, 11 de enero de 2011

CheckStyle configuration distribution

Content:
CheckStyle Eclipse plugin. Installation
Tunning your CheckStyle and Formatter
Every programmer working as only one
What if... I get a "Fileset from project [projectname] has no valid check configuration" Error?
CheckStyle configuration distribution

As we could see in previous posts, it is necessary to broadcast the same style for the same team, organization or project. But I only got the lower case "q" for my post due to I make you, the newbie in the company, to configure the CheckStyle XML in your IDE, for your workspace only.

Using this strategy, a 20 members team have to configure the same 20 times for every workspace, and the number of times a workspace should be changed is undetermined, but I have done it several times this month, and today is 10th of January and I did not work seriously until yesterday :S.

It no longer matter the number of times you change your workspace in your Eclipse IDE, it is simply a bad practice to charge with that duty to your team. It should be done the lesser times possible, the lesser people doing it possible, and the lesser complicated to update possible.

What I am explaining you today is the possibility of configuring CheckStyle at project scope, not IDE scope, sharing the same configuration to all your team with the same commit and, even better, referencing an external file instead a local one, making updates of style immediate for every mate without even knowing.

Erase your previous configuration:
Window Menu ->Preferences -> CheckStyle. Then select your previous home-brew configuration and Remove it.

Now configure your project:
Right click over your project, Properties -> CheckStyle -> Local Check Configurations Tab -> New.
Type: Remote Configuration
Name: Whatever, yes, there's room for creativity today.
Location: URI of the CheckStyle configuration. It would be as perfect as necessary to have the file shared in a ftp server, svn server or any other easy-access way. We settled it under svn control and access it through svn+http apache mod.
Save and close.

And voila, now all your team has to do is update the project and run CheckStyle for that project, automatically the project configuration will be token and only one person had to work for a team benefit.

This is not a perfect way of doing the distribution, but it is rather better than previous, at IDE workspace files. But this configuration seems to me to much IDE-dependant either, I am searching for a better CheckStyle configuration in the Maven descriptor file. I will tell you as soon as I really see it working.

See you.

Alberto Navarro.

No hay comentarios:

Publicar un comentario

Nota: solo los miembros de este blog pueden publicar comentarios.