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.

22 lines
1.4 KiB

7 days ago
# -*- coding: utf-8 -*-
"""检查候选文件的行尾符与 BOM,判定 SearchReplace 失败原因。"""
import io, sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
files = [
r'e:\code\crm-backend-matt\crm-opportunity\src\main\java\com\crm\opportunity\controller\OpportunitySubController.java',
r'e:\code\crm-backend-matt\crm-opportunity\src\main\java\com\crm\opportunity\domain\entity\Opportunity.java',
r'e:\code\crm-backend-matt\crm-opportunity\src\main\java\com\crm\opportunity\schemecard\impl\OpportunitySchemeCardServiceImpl.java',
r'e:\code\crm-backend-matt\crm-opportunity\src\main\java\com\crm\opportunity\constant\OpportunityConstants.java',
r'e:\code\crm-backend-matt\crm-opportunity\src\main\java\com\crm\opportunity\service\impl\OpportunityCreateServiceImpl.java',
r'e:\code\crm-backend-matt\crm-opportunity\src\main\java\com\crm\opportunity\service\impl\OpportunityDetailServiceImpl.java',
r'e:\code\crm-backend-matt\crm-opportunity\src\main\java\com\crm\opportunity\state\impl\OpportunityTransitionImpl.java',
r'e:\code\crm-backend-matt\crm-opportunity\src\main\java\com\crm\opportunity\service\impl\OpportunityCollabServiceImpl.java',
]
for f in files:
b = open(f, 'rb').read()
crlf = b.count(b'\r\n')
lf = b.count(b'\n') - crlf
bom = b[:3] == b'\xef\xbb\xbf'
print(f"{f.split(chr(92))[-1]:55s} CRLF={crlf:4d} LF={lf:4d} BOM={bom}")