Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-05-21 16:59:53 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-05-26 04:53:52 +0300
commit439f32946636c67ce5ce4dfaed799a37632a725f (patch)
treed22a44eb87ae71fc1f896e037acea08f0bfd1592 /utils
parentc4b20a82eac46334b29fe5c37104f5a22c3ef9e5 (diff)
doclinter: Fix files are ignored.
Diffstat (limited to 'utils')
-rw-r--r--utils/doclinter.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/utils/doclinter.py b/utils/doclinter.py
index af310f720..61828668c 100644
--- a/utils/doclinter.py
+++ b/utils/doclinter.py
@@ -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