From d845ecd7fc67105c124d40e9d540fbf43de7ae7f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 29 Jun 2015 17:44:36 +0200 Subject: [PATCH] Also check for spelling errors in .asciidoc/.js files. --- scripts/dev/misc_checks.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/dev/misc_checks.py b/scripts/dev/misc_checks.py index 91b17db7b..3e04b00f5 100644 --- a/scripts/dev/misc_checks.py +++ b/scripts/dev/misc_checks.py @@ -36,14 +36,20 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir, from scripts import utils -def _py_files(): +def _get_files(only_py=False): """Iterate over all python files and yield filenames.""" for (dirpath, _dirnames, filenames) in os.walk('.'): parts = dirpath.split(os.sep) if len(parts) >= 2 and parts[1].startswith('.'): # ignore hidden dirs continue - for name in (e for e in filenames if e.endswith('.py')): + + if only_py: + endings = {'.py'} + else: + endings = {'.py', '.asciidoc', '.js'} + files = (e for e in filenames if os.path.splitext(e)[1] in endings) + for name in files: yield os.path.join(dirpath, name) @@ -87,7 +93,7 @@ def check_spelling(): seen = collections.defaultdict(list) try: ok = True - for fn in _py_files(): + for fn in _get_files(): with tokenize.open(fn) as f: if fn == os.path.join('.', 'scripts', 'dev', 'misc_checks.py'): continue @@ -108,7 +114,7 @@ def check_vcs_conflict(): """Check VCS conflict markers.""" try: ok = True - for fn in _py_files(): + for fn in _get_files(only_py=True): with tokenize.open(fn) as f: for line in f: if any(line.startswith(c * 7) for c in '<>=|'):