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.

27 lines
893 B

7 days ago
# -*- coding: utf-8 -*-
"""票 04:全仓库 .java BOM 扫描(AGENTS.md 纪律:批量编辑后、mvn compile 前)。"""
import os, sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
root = r'e:\code\crm-backend-matt'
bad, scanned = [], 0
for dirpath, dirnames, filenames in os.walk(root):
# 跳过 target / .git 等非源码目录
dirnames[:] = [d for d in dirnames if d not in ('target', '.git', 'node_modules', '.qoder')]
for fn in filenames:
if fn.endswith('.java'):
scanned += 1
p = os.path.join(dirpath, fn)
with open(p, 'rb') as f:
head = f.read(3)
if head == b'\xef\xbb\xbf':
bad.append(p)
print('scanned %d java files' % scanned)
if bad:
print('BOM FOUND %d:' % len(bad))
for p in bad:
print(' ' + p)
else:
print('no BOM - clean')