diff options
author | Martin Mathieson <martin.mathieson@keysight.com> | 2021-01-25 11:24:03 +0000 |
---|---|---|
committer | Martin Mathieson <martin.r.mathieson@googlemail.com> | 2021-01-25 12:25:54 +0000 |
commit | aa78bb854602c95ddf696f354e44b78912330165 (patch) | |
tree | c686f8ee9355aaea45f3ddab5c4a8ed7bbd3f156 | |
parent | 748d63712eda408f58294a4ad0236fbfceacc11b (diff) |
tools/check_spelling.py: Fix args handling
-rwxr-xr-x | tools/check_spelling.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/check_spelling.py b/tools/check_spelling.py index f6d4de410c..e327c078f0 100755 --- a/tools/check_spelling.py +++ b/tools/check_spelling.py @@ -321,7 +321,7 @@ def findFilesInFolder(folder): return files_to_check -# Check the given dissector file. +# Check the given file. def checkFile(filename): # Check file exists - e.g. may have been deleted in a recent commit. if not os.path.exists(filename): @@ -338,9 +338,9 @@ def checkFile(filename): # command-line args. Controls which files should be checked. # If no args given, will just scan epan/dissectors folder. -parser = argparse.ArgumentParser(description='Check calls in dissectors') +parser = argparse.ArgumentParser(description='Check spellings in specified files') parser.add_argument('--file', action='store', default='', - help='specify individual dissector file to test') + help='specify individual file to test') parser.add_argument('--folder', action='store', default='', help='specify folder to test') parser.add_argument('--commits', action='store', @@ -365,26 +365,26 @@ elif args.commits: command = ['git', 'diff', '--name-only', 'HEAD~' + args.commits] files = [f.decode('utf-8') for f in subprocess.check_output(command).splitlines()] - # Will examine dissector files only + # Filter files files = list(filter(lambda f : isAppropriateFile(f) and not isGeneratedFile(f), files)) elif args.open: # Unstaged changes. command = ['git', 'diff', '--name-only'] files = [f.decode('utf-8') for f in subprocess.check_output(command).splitlines()] - # Only interested in dissector files. - files = list(filter(lambda f : is_dissector_file(f), files)) + # Filter files. + files = list(filter(lambda f : isAppropriateFile(f) and not isGeneratedFile(f), files)) # Staged changes. command = ['git', 'diff', '--staged', '--name-only'] files_staged = [f.decode('utf-8') for f in subprocess.check_output(command).splitlines()] - # Only interested in dissector files. - files_staged = list(filter(lambda f : is_dissector_file(f), files_staged)) + # Filter files. + files_staged = list(filter(lambda f : isAppropriateFile(f) and not isGeneratedFile(f), files_staged)) for f in files_staged: if not f in files: files.append(f) else: - # By default, scan dissectors + # By default, scan dissectors directory folder = os.path.join('epan', 'dissectors') # But overwrite with any folder entry. if args.folder: |