Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Call
ka-lint
instead of always using khan-linter's version.
Summary: hook_lib was hard-coded to use khan-linter's ka-lint (which resolves to runlint.py) when doing pre-push linting. But we want it to use webapp's ka-lint when linting in webapp. We do this by having the git hook call out the "ka-lint" binary that is found on the user's path. For now, that will only be the one in khan-linter, so current behavior should be unchanged. But eventually I'll change `ka-lint` on the path to be a multi-plexer that calls out to webapp's version for files in webapp, and khan-linter's version for everything else. When that happens the git hook will start using the correct ka-lint automatically! Test Plan: I temporarily changed this commit to say: stdin = subprocess.PIPE) and ran % python -c 'import hook_lib; print hook_lib.lint_files(["hook_lib.py"])' hook_lib.py:31:31: E251 unexpected spaces around keyword / parameter equals hook_lib.py:31:33: E251 unexpected spaces around keyword / parameter equals 2 So it correctly emitted lint errors to stdout and return a non-zero rc due to the lint errors. Then I ran % env PATH=$HOME/khan/webapp/testing:$PATH python -c 'import hook_lib; print hook_lib.lint_files(["hook_lib.py"])' /home/csilvers/khan/webapp/testing/ka-lint must be run from some directory in webapp-root 1 showing that a) it properly could execute webapp's ka-lint when need be, and b) properly returns an rc of 1 on lint framework errors. Then undid my temporary change and ran: % python -c 'import hook_lib; print hook_lib.lint_files(["hook_lib.py"])' 0 so everything works properly when properly linting. Reviewers: benkraft, davidbraley Reviewed By: benkraft, davidbraley Subscribers: kevinb Differential Revision: https://phabricator.khanacademy.org/D63491
- Loading branch information