Bug 1369710 - [mozlint] Ensure that a valid path is entered. r=ahal

MozReview-Commit-ID: 6HOE9hmOkCx

--HG--
extra : rebase_source : 584a4391b832e794dc084254e9203b3a65c89419
This commit is contained in:
Dyex 2017-08-08 19:20:31 +05:30
parent 3bd6c5f20a
commit db4f4de93a

View File

@ -113,6 +113,12 @@ def run(paths, linters, fmt, outgoing, workdir, **lintargs):
lint = LintRoller(**lintargs)
lint.read(find_linters(linters))
# Check if the path that is entered is a valid one.
invalid_paths = [path for path in paths if not os.path.exists(path)]
if invalid_paths:
print("Error: The following paths do not exist:\n{}".format("\n".join(invalid_paths)))
return 1
# run all linters
results = lint.roll(paths, outgoing=outgoing, workdir=workdir)
formatter = formatters.get(fmt)