diff --git a/Script/CI/check_coding_rule.py b/Script/CI/check_coding_rule.py index b50a0a006..cbaf8d2f9 100644 --- a/Script/CI/check_coding_rule.py +++ b/Script/CI/check_coding_rule.py @@ -47,6 +47,7 @@ def main(): check_operator_space_, check_preprocessor_, check_include_guard_, + check_binary_operator_before_linebreak_, ] check_funcs = [] @@ -678,6 +679,23 @@ def check_include_guard_(path: str, code_lines: list) -> bool: return False +def check_binary_operator_before_linebreak_(path: str, code_lines: list) -> bool: + ptn = r'^\s*([+\-*/%]|<<|>>|<=|>=|==|!=|&{1,2}|\|{1,2}|\^)\s+' + reptn = re.compile(ptn) + for idx, line in enumerate(code_lines): + if is_in_comment_context_in_multiline_(path, code_lines, idx): + continue + + matched = reptn.match(line) + if matched is None: + continue + + print_err_(path, idx, f'LINE {idx} HAS STARTED WITH THE OPERATOR {matched.group(1)}.', line) + return False + + return True + + # True: target が含まれる, False: なし def is_contained_pattern_(line: str, target: str) -> bool: pos = 0