Code Analysis for CSS, HTML and javascript

↘锁芯ラ 提交于 2019-12-10 18:35:19

问题


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.


回答1:


For javascript check out JSLint:

http://www.jslint.com/




回答2:


For CSS you can use csslint tool.

http://csslint.net/

It can be execute from command line also.

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




回答3:


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++.



来源:https://stackoverflow.com/questions/2692072/code-analysis-for-css-html-and-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!