Code analysis for CSS, HTML and javascript

Can someone point me towards a software like StyleCop for C # that can parse CSS, HTML and javascript against sets of predefined rules / custom rules.

For instance,

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

Ideally, tools that can run as part of msbuild would be helpful, so they can be included as part of a quality build. Tools run by developers are also desirable.

+2


a source to share


3 answers


For javascript validation JSLint:



http://www.jslint.com/

+2


a source


In CSS, you can use the csslint tool.

http://csslint.net/



It can also be executed from the command line.

https://github.com/stubbornella/csslint/wiki/Command-line-interface

+1


a source


If you want to customize rules for a wide variety of languages, you can use the DMS Software Reengineering Toolkit .

The DMS has compiler-style parsers for a wide variety of languages ​​(including dirty HTML and JavaScript), as well as facilities for defining dialects of those langauges (eg CSS for HTML). These parsers generate complete abstract syntax trees, and then you can code your own scripts for the DMS to walk through those trees and check that your style conventions have not been violated. DMS-based tools are easily incorporated into command scripts.

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

0


a source







All Articles