-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Install node: http://nodejs.org/ Install npm: curl https://npmjs.org/install.sh | sudo sh Install jshint: sudo npm install -g jshint Install pep8 and pylint: pip install pep8 pylint Test Plan: modify a .js or .py file Reviewers: bogdan2412 Reviewed By: bogdan2412 Differential Revision: http://phab.code4fun.de/D2
- Loading branch information
Showing
6 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
{ | ||
"project_id": "CodeStreak", | ||
"conduit_uri": "http://phab.code4fun.de/" | ||
"conduit_uri": "http://phab.code4fun.de/", | ||
"load": [ | ||
"libcustom/src" | ||
], | ||
"lint.engine": "DefaultLintEngine", | ||
|
||
"lint.jshint.prefix": "/usr/local/bin", | ||
"lint.jshint.bin": "jshint", | ||
"lint.jshint.config": ".jshintconfig", | ||
|
||
"lint.pylint.codes.error": "^(E|F).*", | ||
"lint.pylint.codes.warning": "^(W|R|C).*", | ||
"lint.pylint.codes.advice" : "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"browser": true, | ||
"devel": true, | ||
"jquery": true, | ||
|
||
"indent" : 2, | ||
"bitwise" : true, | ||
"trailing" : true, | ||
"curly" : true, | ||
"eqeqeq" : true, | ||
"undef" : true, | ||
"immed" : true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.phutil_module_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
phutil_register_library('libcustom', __FILE__); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* This file is automatically generated. Use 'arc liberate' to rebuild it. | ||
* @generated | ||
* @phutil-library-version 2 | ||
*/ | ||
|
||
phutil_register_library_map(array( | ||
'__library_version__' => 2, | ||
'class' => | ||
array( | ||
'DefaultLintEngine' => 'lint/DefaultLintEngine.php', | ||
), | ||
'function' => | ||
array( | ||
), | ||
'xmap' => | ||
array( | ||
'DefaultLintEngine' => 'ArcanistLintEngine', | ||
), | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
final class DefaultLintEngine extends ArcanistLintEngine { | ||
private $static_file_regexp = array( | ||
"^(M|m)akefile$", | ||
"\.min\.(js|css)$", | ||
"\.json$", | ||
"^db.sqlite3$", | ||
); | ||
public function buildLinters() { | ||
|
||
// This is a list of paths which the user wants to lint. Either they | ||
// provided them explicitly, or arc figured them out from a commit or set | ||
// of changes. The engine needs to return a list of ArcanistLinter objects, | ||
// representing the linters which should be run on these files. | ||
$paths = $this->getPaths(); | ||
|
||
// Linters are responsible for actually analyzing the contents of a file | ||
// and raising warnings and errors. | ||
$python_linter = new ArcanistPyLintLinter(); | ||
$js_linter = new ArcanistJSHintLinter(); | ||
$file_linter = new ArcanistTextLinter(); | ||
|
||
// Remove any paths that don't exist before we add paths to linters. We want | ||
// to do this for linters that operate on file contents because the | ||
// generated list of paths will include deleted paths when a file is | ||
// removed. | ||
foreach ($paths as $key => $path) { | ||
if (!$this->pathExists($path)) { | ||
unset($paths[$key]); | ||
} | ||
} | ||
|
||
/* | ||
$file_linter->setPaths($paths); | ||
$python_linter->setPaths(preg_grep('/\.py$/', $paths)); | ||
$js_linter->setPaths(preg_grep('/\.js$/', $paths)); | ||
*/ | ||
|
||
foreach ($paths as $path) { | ||
if (preg_match('@/static/.*/img/@', $path)) { | ||
continue; | ||
} | ||
if (preg_match('@/externals/@', $path)) { | ||
continue; | ||
} | ||
|
||
// whitespace | ||
$match = "/(" . implode("|",$this->static_file_regexp) . ")/"; | ||
if (!preg_match($match, $path)) { | ||
$file_linter->addPath($path); | ||
} | ||
|
||
// python | ||
if (preg_match('/\.py$/', $path) | ||
&& !preg_match('/\/xhpy\//', $path) | ||
&& !preg_match('/views.py$/', $path)) { | ||
$python_linter->addPath($path); | ||
} | ||
|
||
// javascript | ||
if (preg_match('/\.js$/', $path) && !preg_match('/\.min\.js$/', $path)) { | ||
$js_linter->addPath($path); | ||
} | ||
} | ||
|
||
return array( | ||
$python_linter, | ||
$js_linter, | ||
$file_linter, | ||
); | ||
} | ||
|
||
} |