diff --git a/check_source/check_style_c.py b/check_source/check_style_c.py index 19e739e9f0c99180f343d60565d473713245ba54..4097c0eaa03c93f2454a15665021ee87c6f5ba49 100755 --- a/check_source/check_style_c.py +++ b/check_source/check_style_c.py @@ -1090,6 +1090,9 @@ def quick_check_indentation(lines): t_prev = -1 ls_prev = "" + ws_prev = "" + ws_prev_expand = "" + for i, l in enumerate(lines): skip = False @@ -1147,6 +1150,17 @@ def quick_check_indentation(lines): (t - t_prev, tabs), i + 1) t_prev = t + # check for same indentation with different space/tab mix + ws = l[:len(l) - len(l.lstrip())] + ws_expand = ws.expandtabs(4) + if ws_expand == ws_prev_expand: + if ws != ws_prev: + warning_lineonly("E152", "indentation tab/space mismatch", + i + 1) + ws_prev = ws + ws_prev_expand = ws_expand + + import re re_ifndef = re.compile("^\s*#\s*ifndef\s+([A-z0-9_]+).*$") re_define = re.compile("^\s*#\s*define\s+([A-z0-9_]+).*$")