doclinter: Fix files are ignored.

This commit is contained in:
Takeshi KOMIYA 2019-05-21 22:59:53 +09:00
parent c4b20a82ea
commit 439f329466

View File

@ -60,12 +60,15 @@ def lint(path: str) -> int:
def main(args: List[str]) -> int:
errors = 0
for directory in args:
for root, dirs, files in os.walk(directory):
for filename in files:
if filename.endswith('.rst'):
path = os.path.join(root, filename)
errors += lint(path)
for path in args:
if os.path.isfile(path):
errors += lint(path)
elif os.path.isdir(path):
for root, dirs, files in os.walk(path):
for filename in files:
if filename.endswith('.rst'):
path = os.path.join(root, filename)
errors += lint(path)
if errors:
return 1