views:

52

answers:

2

Hello,

I am working on a project where we have many JSF pages - using the XHTML format. We monitor the quality of our code using Sonar (and thus Checkstyle, PMD, FindBugs...). This works great for the Java part of our application.

Now, I want to have a tool (ideally something that could then be linked to Sonar by writing my own plugin) that checks the XHTML part of my application.

So, is there a checkstyle-like tool that can check for some rules on my pages? For example, this tool will raise a warning when I encounter these kind of code:

<h:inputText ...></h:inputText> (instead of <h:inputText .../>)

or :

<h:panelGrid columns="1">
     ...
</h:panelGrid> (a <h:panelGroup> is better here)

I'm aware that Checkstyle offers a rule that is based on a regular expression, but I fear that solution is too complex for some rules...

+1  A: 

There's always the venerable "HTML Tidy". Or you could consider extending checkstyle itself.

You might want to focus attention here: http://jira.codehaus.org/browse/SONARPLUGINS-130

Zac Thompson
A: 

I've recently found the Sonar Web plugin that provides static code analysis of JSP and JSF files. The main features of this plugin are:

  • sizing (files, lines of code)
  • rules compliancy
  • complexity
  • duplication
  • comments

I will try it soon (I need to install the latest Sonar 2.2 version) and give feedbacks.

romaintaz