Skip to content
Lint and code-munging tools for Khan Academy codebase
Python JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
closure_linter
LICENSE
README
hghook.py
requirements.txt
runlint.py

README

This repository contains linting tools for Khan Academy's codebase.

Most of the JavaScript linting code is based on Google's freely available and open-source Closure Linter:
http://code.google.com/closure/utilities/

It has been modified to suit Khan Academy's slightly different style guides and wrapper scripts have been created to be used as pre-commit hooks for Mercurial.


Usage
==========

First, install dependent packages via the requirements.txt file

$ pip install -r requirements.txt

Then you can automatically invoke lints on modified or added files in Mercurial.
Add to .hgrc to use:

[hooks]
pretxncommit.lint = /path/to/khan-linter/hghook.py

If the project has a lint-blacklist.txt in the top level directory of the project, files listed there will be ignored in the linting process. This can be useful for legacy files.

If a forced commit is required, set the environment variable  FORCE_COMMIT to 1 prior to calling 'hg commit' (there doesn't  seem to be a way to pass args to a pretxncommit script otherwise)

If you would like to lint manually, invoke gjslint.py. You can try to also use fixjsstyle.py to automatically fix some style violations.
Something went wrong with that request. Please try again.