Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Added detail to the README (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
wibblymat committed Feb 15, 2013
1 parent 9dd28e3 commit e03af49
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Expand Up @@ -3,3 +3,27 @@
[![Build Status](https://travis-ci.org/wibblymat/styleguru.png)](https://travis-ci.org/wibblymat/styleguru)

A little tool to check that your source files meet your code style.

##What is this?

This is an unfinished, proof-of-concept tool for checking that JavaScript source files meet YOUR code style guidelines. For the moment it should be considered an experiment.

It should report the errors by default - optionally in a format that other tools can consume - but it should also be capable of fixing the errors it finds automatically.

##Isn't there already something like this out there?

Not that I could find, but please let me know if you know of something!

The closest alternatives:

* **JSHint/JSLint** - Both of these tools support an option called "white" that will enable a check for "correct" whitespace. Unfortunately the whitespace rules are not configurable and not well-documented. While many have been chosen for sensible reasons, there is a good chunk of Douglas Crockford's personal taste embedded. These tools can only alert you to style problems, not fix them.
* **fixjsstyle** - This tool is part of the Google Closure Linter. When it detects simple problems it just fixes them, which is great. Still not configurable, though, so if you aren't working to the Google Style Guide it is no use.
* **CodePainter** - This tool is meant to find and/or fix code in abitrary style, much like StyleGuru. Sadly the project has been abandoned. The author has stated that he wasn't happy with the approach he was taking so it is unlikely to be resurrected.

##So where have you got to?

I'm blocked on a couple of issues I'm not sure how to solve, but it should let you know when you deviate from my own personal style preferences. There are a few false positives at the moment though. The output is big mess of JSON.

Most of my blocking issues could be solved by forking Esprima and adding some extra detail to the AST it produces - nodes for parenthesised sub-expressions and parameter/argument lists, adding tokens to the node they belong to rather than having just one set for the whole script, whitespace tokens, better comment information, line wrapping, etc. Maintaining a fork sounds like hard work though so I might instead try and push those ideas upstream. We'll see.

I'd like to get things working with one fixed style before moving on to configuration. In the interests of being more useful earlier I will probably use the jQuery style guidelines as the fixed style.

0 comments on commit e03af49

Please sign in to comment.