清理全库行尾空格与文件尾换行(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
+7 -7
View File
@@ -5,23 +5,23 @@ base = 'D:\\Code\\DTU 程序\\STM32F4-Base\\'
all_fixes = [
# (filename, pattern_to_match, replacement_full_line_fragment)
# ch395f.c
('ch395f.c', 'rx_buf[' + rep + '? * 阻塞', 'rx_buf] * 阻塞'),
('ch395f.c', '默认值10' + rep + '?秒)', '默认值10 秒)'),
('ch395f.c', '默认值3' + rep + '? uint8_t', '默认值3 uint8_t'),
# ch395f_test.c
('ch395f_test.c', '回显' + rep + '? \ufffd?PING', '回显,PING'),
('ch395f_test.c', '创建' + rep + '? UDP', '创建 UDP'),
('ch395f_test.c', 'IP,打印结果 ' + rep + '?广播', 'IP,打印结果,广播'),
# gd5f2gq5ue.c
('gd5f2gq5ue.c', '块对' + rep + '? * size', '块对齐 * size'),
# sd2506.c
('sd2506.c', '个位存入' + rep + '4 )', '个位存入低 4 )'),
# tpafe5160.c
('tpafe5160.c', '6位数据总线' + rep + '?GPIOG', '16位数据总线(GPIOG'),
('tpafe5160.c', '滞后约 18-24ns' + rep + '? *', '滞后约 18-24ns,*'),
@@ -61,7 +61,7 @@ for fname, needle, replacement in all_fixes:
raw = f.read()
text = raw.decode('utf-8', errors='replace')
before = text.count(rep)
if needle in text:
text = text.replace(needle, replacement)
after = text.count(rep)
@@ -82,7 +82,7 @@ for fname, needle, replacement in all_fixes:
break
if not found:
print('{}: pattern not found at all'.format(fname))
with open(path, 'wb') as f:
f.write(text.encode('utf-8'))