清理全库行尾空格与文件尾换行(pre-commit 自动修复基线)

This commit is contained in:
2026-09-01 10:24:50 +08:00
parent 2769bf33a0
commit ae8b1aead5
129 changed files with 2507 additions and 2625 deletions
+5 -5
View File
@@ -53,11 +53,11 @@ for fname in files:
if before == 0:
print('{}: clean'.format(fname))
continue
# Apply generic pattern fixes
for pattern, replacement in generic_fixes:
text = re.sub(pattern, replacement, text)
# Manual patterns for each file
if 'ch395f.c' in fname:
text = text.replace(rep + '?' + u'DMA 接收缓冲区偏移', u'从 DMA 接收缓冲区偏移')
@@ -107,14 +107,14 @@ for fname in files:
text = text.replace(u'主循环' + rep + '?s_buf_a', u'主循环读 s_buf_a')
text = text.replace(u'GPIO ' + rep + '?NVIC', u'GPIO 和 NVIC')
text = text.replace(u'调用' + rep + '? * 入口参数', u'调用)* 入口参数')
after = text.count(rep)
fixed = before - after
total_fixed += fixed
with open(path, 'wb') as f:
f.write(text.encode('utf-8'))
print('{}: fixed {} ({} -> {})'.format(fname, fixed, before, after))
print('\nTotal fixed: {}'.format(total_fixed))