You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
831 B

1 week ago
# -*- coding: utf-8 -*-
"""票 06:BOM 扫描(AGENTS.md 强制项)——本次改动的全部 java 文件,含 UTF-8 BOM 即报。"""
import io, sys, os
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
roots = [
r'e:\code\crm-backend-matt\crm-opportunity\src',
r'e:\code\crm-backend-matt\crm-rule\src',
]
bad, n = [], 0
for root in roots:
for dirpath, _, files in os.walk(root):
for f in files:
if not f.endswith('.java'):
continue
n += 1
p = os.path.join(dirpath, f)
with open(p, 'rb') as fh:
if fh.read(3) == b'\xef\xbb\xbf':
bad.append(p)
print(f"scanned {n} java files")
if bad:
print("BOM FOUND:")
for p in bad:
print(" " + p)
sys.exit(1)
print("OK: no BOM")