Skip to content

Commit

Permalink
Added fix for missing filepath, fixes #58
Browse files Browse the repository at this point in the history
  • Loading branch information
twolfson committed Feb 24, 2022
1 parent 6104f61 commit fc9a384
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion restructuredtext_lint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ def _main(paths, format=DEFAULT_FORMAT, stream=sys.stdout, encoding=None, level=
# Check if the given path is a file or a directory
if os.path.isfile(path):
filepaths.append(path)
else:
elif os.path.isdir(path):
# Recurse over subdirectories to search for *.rst files
for root, subdir, files in os.walk(path):
for file in files:
if file.endswith('.rst'):
filepaths.append(os.path.join(root, file))
else:
stream.write('Path "{path}" not found as a file nor directory\n'.format(path=path))
sys.exit(1)
return

for filepath in filepaths:
# Read and lint the file
Expand Down

0 comments on commit fc9a384

Please sign in to comment.