Make lint.py fail when the specified path doesn't exist

develop
lethosor 2015-02-21 23:06:50 -05:00
parent 100fce0419
commit f81bee7a94
1 changed files with 3 additions and 0 deletions

@ -88,6 +88,9 @@ linters = [NewlineLinter(), TrailingWhitespaceLinter(), TabLinter()]
def main(): def main():
root_path = os.path.abspath(sys.argv[1] if len(sys.argv) > 1 else '.') root_path = os.path.abspath(sys.argv[1] if len(sys.argv) > 1 else '.')
if not os.path.exists(root_path):
print('Nonexistent path: %s' % root_path)
sys.exit(2)
fix = (len(sys.argv) > 2 and sys.argv[2] == '--fix') fix = (len(sys.argv) > 2 and sys.argv[2] == '--fix')
global path_blacklist global path_blacklist
path_blacklist = map(lambda s: os.path.join(root_path, s), path_blacklist) path_blacklist = map(lambda s: os.path.join(root_path, s), path_blacklist)