diff --git a/scripts/clean_comments.py b/scripts/clean_comments.py index 67a900e..2c880af 100644 --- a/scripts/clean_comments.py +++ b/scripts/clean_comments.py @@ -1,8 +1,10 @@ #!/usr/bin/env python3 """Clean violation patterns from dacli source comments. + Targets 6 patterns from check_clean_comments.sh: - 1. BS-[a-zA-Z]*[0-9] 2. R[0-9]+[a-z]*\b 3. Round[0-9]+ - 4. jxcj|workSystem|developSystem|tds 5. v0\.[0-9]+[a-z]*\+ 6. ssw-[a-z]+-(biz|common) + 1. BS-[a-zA-Z]*[0-9] 2. R[0-9]+[a-z]* 3. Round[0-9]+ + 4. jxcj|workSystem|developSystem|tds 5. v0.XX.YY+ 6. ssw-XXX-biz/common + Only modifies comment lines (//, *, /*). """ import re, sys, os @@ -37,17 +39,16 @@ def clean_line(line: str) -> str: # --- Pattern 4: jxcj/workSystem/developSystem/tds --- # Only in comments. Replace with generic term. - line = re.sub(r'\bjxcj\s+M1\b', 'app', line) line = re.sub(r'\bjxcj\b', 'app', line) - line = re.sub(r'\bworkSystem\b', 'workSystem', line) # keep as-is for now (hard to replace) - line = re.sub(r'\bdevelopSystem\b', 'developSystem', line) + line = re.sub(r'\bworkSystem\b', 'reference app', line) + line = re.sub(r'\bdevelopSystem\b', 'reference app', line) line = re.sub(r'\btds\b', 'app', line) - # --- Pattern 5: v0.x+ version markers --- - if re.match(r'^\s*//\s*v0\.\d+[a-z]*\+?\s*$', line): return '' - if re.match(r'^\s*\*\s*v0\.\d+[a-z]*\+?\s*$', line): return '' - line = re.sub(r'v0\.\d+[a-z]*\+?\s*:\s*', '', line) - line = re.sub(r'v0\.\d+[a-z]*\+?\s+', '', line) + # --- Pattern 5: v0.x+ version markers (handle v0.10, v0.10.1, v0.11h+, v0.21+) --- + if re.match(r'^\s*//\s*v0\.\d+(?:\.\d+)?[a-z]*\+?\s*$', line): return '' + if re.match(r'^\s*\*\s*v0\.\d+(?:\.\d+)?[a-z]*\+?\s*$', line): return '' + line = re.sub(r'v0\.\d+(?:\.\d+)?[a-z]*\+?\s*(?:fix|修复|修正)?\s*:\s*', '', line) + line = re.sub(r'v0\.\d+(?:\.\d+)?[a-z]*\+?\s+', '', line) # --- Pattern 6: ssw-*-biz/ssw-common --- # Only in comments. Remove or simplify.