huacnlee / autocorrect

A linter and formatter to help you to improve copywriting, correct spaces, words, and punctuations between CJK (Chinese, Japanese, Korean).
https://huacnlee.github.io/autocorrect
MIT License
894 stars 31 forks source link

不能通过自定义配置文件限制 `--fix` 的参数 #186

Closed ykla closed 4 months ago

ykla commented 4 months ago

似乎即使自定义了 rules,fix 参数也不会受规则的限制。

比如设置了 space-dash: 0 ,即该参数不对 - 进行处理,但是 --fix 参数仍然会进行处理。

C:\Users\ykla\Documents\GitHub\ykla\SEP-CN>C:\Users\ykla\Desktop\autocorrect.exe  --config C:\Users\ykla\.autocorrectrc  --fix README.md
.

AutoCorrect spend time: 23.21ms

仍然会导致人名 弗朗索瓦-马里‧阿鲁埃 变成 弗朗索瓦 - 马里‧阿鲁埃

配置文件 .autocorrectrc 如下:

# yaml-language-server: $schema=https://huacnlee.github.io/autocorrect/schema.json
# Config rules
rules:
  # Auto add spacing between CJK (Chinese, Japanese, Korean) and English words.
  # 0 - off, 1 - error, 2 - warning
  space-word: 1
  # Add space between some punctuations.
  space-punctuation: 1
  # Add space between brackets (), [] when near the CJK.
  space-bracket: 1
  # Add space between ``, when near the CJK.
  space-backticks: 1
  # Add space between dash `-`
  space-dash: 0
  # Convert to fullwidth.
  fullwidth: 1
  # To remove space near the fullwidth.
  no-space-fullwidth: 1
  # Fullwidth alphanumeric characters to halfwidth.
  halfwidth-word: 1
  # Fullwidth punctuations to halfwidth in english.
  halfwidth-punctuation: 1
  # Spellcheck
  spellcheck: 0

即使是先检查,再 fix 效果也是一样的。

 C:\Users\ykla\Documents\GitHub\ykla\SEP-CN>C:\Users\ykla\Desktop\autocorrect.exe  --config C:\Users\ykla\.autocorrectrc  --lint  README.md

另请参见 https://github.com/taophilosophy/SEP-CN/actions/runs/8945663831/job/24574995842

huacnlee commented 4 months ago

https://github.com/huacnlee/autocorrect/releases/tag/v2.9.1