3

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
  • "css - to ensure camel case is used for class names" Interesting. I actually prefer hyphenated classes. Commented Apr 22, 2010 at 15:22

4 Answers 4

2

For javascript check out JSLint:

http://www.jslint.com/

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

0

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

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.