views:

143

answers:

2

Can anybody point me in the direction of software similar to StyleCop for C# which can analyse CSS, HTML and javascript against sets of predefined rules / custom rules.

For Example,

  • css - to ensure camel case is used for class names
  • html - to ensure inline sytles are not used
  • javascript - not sure yet :P

Ideally, tools which can be run as-part of msbuild would be benefical so they can be included as part of a quality build. Tools runnable by developers would also be desirable.

+2  A: 

For javascript check out JSLint:

http://www.jslint.com/

Kevin
A: 

If you want customizable rules for a wide variety of languages, you can consider using the DMS Software Reengineering Toolkit.

DMS has compiler-style parsers for a wide variety of langauges (including "dirty" HTML and JavaScript) as well as means to define dialects of such langauges (e.g., CSS for HTML). These parsers build full abstract syntax trees, and then you can code custom scripts for DMS to walk over these trees and check that your style conventions have not been violated. DMS-based tools are easily incorporated into command scripts.

DMS has already been used for this purpose for both COBOL and C++.

Ira Baxter