diff --git a/python/mozlint/mozlint/cli.py b/python/mozlint/mozlint/cli.py index fb42dafd4029..058a0ffe0c8c 100644 --- a/python/mozlint/mozlint/cli.py +++ b/python/mozlint/mozlint/cli.py @@ -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)