开发者

Code Analysis for CSS, HTML and javascript

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 e开发者_JAVA技巧nsure 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.


For javascript check out JSLint:

http://www.jslint.com/


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


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


If you are working with Visual Studio then you can try Web Analyzer

It's Lints JavaScript, JSX, TypeScript, CoffeeScript and CSS files using:

CssLint
ESLint (a better version of JSHint, JSLint and JSCS)
CoffeeLint
TSLint

https://marketplace.visualstudio.com/items?itemName=MadsKristensen.WebAnalyzer&ssr=false#overview

Note: Work better for visual studio 2015 and lower version.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜