Is there any tool to do for JSP files what checkstyle does for Java files? The ideal would be to include JSP checking开发者_开发百科 on checkstyle, but as far as I can see, this isn't possible.
I would like for example to check JSP files for :
- Indentation style
- Right placements of certain constructs
- Tab / space check
- Check for use of scriplets
Thanks Emerson
Yes, there is something similar (but not for exactly those checks): You can use IntelliJ IDEA's "Inspection" functionality to inspect JSPs for various problems, and those inspections can be run from the command line too (use inspect.bat in IntelliJ's /bin directory).
For this you will need to create a "profile" to include only the desired JSP inspections, test it from the IDE (Analyze/Inspect Code), and if they're OK, run them from the command line too (and e.g. call them from your build tool).
Based on those existing JSP inspections, than you could write other inspections too (but this require a little more skill since there's no good documentation for this - just the source code of IntelliJ plug-ins and the support forums)
PMD supports checking of JSP files as well. There are very few rules though. I haven't used it extensively. Feel free to try it out.
精彩评论