Difference between revisions of "Platform Team/Sugar Lint"

From Sugar Labs
Jump to navigation Jump to search
Line 27: Line 27:
  
 
  sugar-lint -r .
 
  sugar-lint -r .
 +
 +
If fails were detected, call diff command (by default {{Code|vimdiff}} or {{Code|DIFFER}} environment variable value) to diff the source file and temporary file with comments in problematic places:
 +
 +
sugar-lint -d ''<file>''
  
 
== Lint files before commiting ==
 
== Lint files before commiting ==

Revision as of 10:14, 5 July 2010

Summary

A set of configuration files and scripts to lint various sugar related code.

For python files, sugar-lint will call pylint (should be installed before) with custom configuration file and pep8.py (comes with sugar-lint sources).

Install

Clone sugar-lint repository:

git clone git://git.sugarlabs.org/sugar-lint/mainline.git <local-path>

Add sugar-lint command to PATH e.g. to ~/.bashrc (you need to relogin):

echo PATH=<local-path>:$PATH >> ~/.bashrc

Direct usage

To lint files:

sugar-lint <file>

To lint all files recursively:

sugar-lint -r .

If fails were detected, call diff command (by default vimdiff or DIFFER environment variable value) to diff the source file and temporary file with comments in problematic places:

sugar-lint -d <file>

Lint files before commiting

To add pre-commit git hook to lint files before commiting to arbitrary project:

ln -s <local-path>/sugar/lint/git-pre-commit-hook <project-root>/.git/hooks/pre-commit

Resources