aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Mathieson <martin.r.mathieson@googlemail.com>2024-02-13 09:31:56 +0000
committerMartin Mathieson <martin.r.mathieson@googlemail.com>2024-02-13 09:31:56 +0000
commitf845ce118ede41664c1d02ec52b5a5e4cc06d802 (patch)
treef9d461caca2c21b26ee1c3ca7bd704f296c2d81c
parentcf22e64b21c372feb15a73b7d163e7780b566337 (diff)
check_spelling.py: add globs
-rw-r--r--epan/dissectors/packet-kafka.c2
-rw-r--r--epan/dissectors/packet-umts_fp.c6
-rwxr-xr-xtools/check_spelling.py39
3 files changed, 33 insertions, 14 deletions
diff --git a/epan/dissectors/packet-kafka.c b/epan/dissectors/packet-kafka.c
index 181ae56ef9..a63f130fd9 100644
--- a/epan/dissectors/packet-kafka.c
+++ b/epan/dissectors/packet-kafka.c
@@ -4938,7 +4938,7 @@ dissect_kafka_sync_group_request_group_assignment(tvbuff_t *tvb, packet_info *pi
offset = dissect_kafka_string(subtree, hf_kafka_member_id, tvb, pinfo, offset, api_version >= 4,
&member_start, &member_len);
- /* member_assigment */
+ /* member_assignment */
offset = dissect_kafka_bytes(subtree, hf_kafka_member_assignment, tvb, pinfo, offset, api_version >= 4, NULL, NULL);
if (api_version >= 4) {
diff --git a/epan/dissectors/packet-umts_fp.c b/epan/dissectors/packet-umts_fp.c
index 4f615af6e5..b8d8d2f2be 100644
--- a/epan/dissectors/packet-umts_fp.c
+++ b/epan/dissectors/packet-umts_fp.c
@@ -2799,7 +2799,7 @@ dissect_e_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree *subframe_tree;
guint bits_in_subframe = 0;
guint mac_d_pdus_in_subframe = 0;
- guint lchid=0; /*Logcial channel id*/
+ guint lchid=0; /*Logical channel id*/
guint32 user_identity;
umts_mac_info *macinf;
bit_offset = 0;
@@ -4171,7 +4171,7 @@ heur_dissect_fp_dcch_over_dch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
}
/* Checking if the 4th byte in the frame is zeroed. In this case the CRC checks aren't */
- /* deterministic enough to gurantee this is a DCH since this packet could also be a PCH frame */
+ /* deterministic enough to guarantee this is a DCH since this packet could also be a PCH frame */
/* with PI Bitmap of 18 bytes + 0 TBs (Both CRCs will match for both formats) */
pch_collisions_byte = tvb_get_guint8(tvb, 3);
if (pch_collisions_byte == 0) {
@@ -4686,7 +4686,7 @@ heur_dissect_fp_pch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
cfn_lowest_bits = tvb_get_guint8(tvb, 2) & 0xF0;
if(cfn_lowest_bits == 0) {
/* Checking if the 4th byte in the frame is zeroed. In this case the CRC checks aren't */
- /* deterministic enough to gurantee this is a PCH since this packet could also be a DCH frame */
+ /* deterministic enough to guarantee this is a PCH since this packet could also be a DCH frame */
/* with MAC's C/T is 0 and 4 leftmost bits of RLC are 0 */
dch_collisions_byte = tvb_get_guint8(tvb, 3);
if (dch_collisions_byte == 0) {
diff --git a/tools/check_spelling.py b/tools/check_spelling.py
index 5b39a8b0b6..d3a46d7e27 100755
--- a/tools/check_spelling.py
+++ b/tools/check_spelling.py
@@ -11,6 +11,7 @@ import re
import subprocess
import argparse
import signal
+import glob
from collections import Counter
# Looks for spelling errors among strings found in source or documentation files.
@@ -427,8 +428,10 @@ def checkFile(filename, check_comments=False):
parser = argparse.ArgumentParser(description='Check spellings in specified files')
parser.add_argument('--file', action='append',
help='specify individual file to test')
-parser.add_argument('--folder', action='store', default='',
+parser.add_argument('--folder', action='append',
help='specify folder to test')
+parser.add_argument('--glob', action='store', default='',
+ help='specify glob to test - should give in "quotes"')
parser.add_argument('--no-recurse', action='store_true', default='',
help='do not recurse inside chosen folder')
parser.add_argument('--commits', action='store',
@@ -452,14 +455,15 @@ if args.file:
exit(1)
else:
files.append(f)
-elif args.commits:
+if args.commits:
# Get files affected by specified number of commits.
command = ['git', 'diff', '--name-only', 'HEAD~' + args.commits]
files = [f.decode('utf-8')
for f in subprocess.check_output(command).splitlines()]
# Filter files
files = list(filter(lambda f : os.path.exists(f) and isAppropriateFile(f) and not isGeneratedFile(f), files))
-elif args.open:
+
+if args.open:
# Unstaged changes.
command = ['git', 'diff', '--name-only']
files = [f.decode('utf-8')
@@ -475,24 +479,39 @@ elif args.open:
for f in files_staged:
if not f in files:
files.append(f)
-else:
- # By default, scan dissectors directory
- folder = os.path.join('epan', 'dissectors')
- # But overwrite with any folder entry.
- if args.folder:
- folder = args.folder
+
+if args.glob:
+ # Add specified file(s)
+ for f in glob.glob(args.glob):
+ if not os.path.isfile(f):
+ print('Chosen file', f, 'does not exist.')
+ exit(1)
+ else:
+ files.append(f)
+
+if args.folder:
+ for folder in args.folder:
if not os.path.isdir(folder):
print('Folder', folder, 'not found!')
exit(1)
+ # Find files from folder.
+ print('Looking for files in', folder)
+ files += findFilesInFolder(folder, not args.no_recurse)
+
+# By default, scan dissector files.
+if not args.file and not args.open and not args.commits and not args.glob and not args.folder:
+ # By default, scan dissectors directory
+ folder = os.path.join('epan', 'dissectors')
# Find files from folder.
print('Looking for files in', folder)
files = findFilesInFolder(folder, not args.no_recurse)
+
# If scanning a subset of files, list them here.
print('Examining:')
-if args.file or args.folder or args.commits or args.open:
+if args.file or args.folder or args.commits or args.open or args.glob:
if files:
print(' '.join(files), '\n')
else: