vale

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Vale Lint & Fix

Vale Lint & Fix

Run Vale on files, then fix issues directly based on the lint output.
对文件运行Vale,然后基于lint输出直接修复问题。

Workflow

工作流

  1. Run Vale with JSON output on the target file(s):
bash
vale --output=JSON <file-or-glob>
  1. Parse the JSON output. Each issue has:
    • Line
      ,
      Span
      (column range) — location
    • Check
      — rule name (e.g.
      Microsoft.Passive
      ,
      write-good.Weasel
      )
    • Message
      — human-readable explanation
    • Severity
      error
      ,
      warning
      , or
      suggestion
    • Action.Name
      — suggested fix type (
      replace
      ,
      remove
      ,
      edit
      )
    • Action.Params
      — replacement candidates
  2. Read the file and fix each issue:
    • For
      replace
      actions with clear suggestions: apply the best-fit replacement
    • For stylistic issues (passive voice, wordiness, weasel words): rewrite the sentence
    • For issues requiring judgment: use context to determine the best fix
    • Skip rules that conflict with the document's domain (e.g. medical terminology flagged as jargon)
  3. Re-run Vale after fixes to verify issues are resolved. Repeat if needed.
  1. 运行Vale,对目标文件输出JSON格式结果:
bash
vale --output=JSON <file-or-glob>
  1. 解析JSON输出,每个问题包含以下字段:
    • Line
      Span
      (列范围)—— 问题位置
    • Check
      —— 规则名称(例如
      Microsoft.Passive
      write-good.Weasel
    • Message
      —— 可读性说明
    • Severity
      —— 问题等级:
      error
      (错误)、
      warning
      (警告)或
      suggestion
      (建议)
    • Action.Name
      —— 建议修复类型:
      replace
      (替换)、
      remove
      (删除)、
      edit
      (编辑)
    • Action.Params
      —— 替换候选内容
  2. 读取文件并修复每个问题:
    • 对于有明确建议的
      replace
      操作:应用最合适的替换内容
    • 对于风格类问题(被动语态、冗余表述、模糊用词):重写相关句子
    • 对于需要主观判断的问题:结合上下文确定最佳修复方案
    • 跳过与文档所属领域冲突的规则(例如医疗术语被标记为行话的情况)
  3. 修复完成后重新运行Vale,验证问题已解决,必要时重复上述流程。

Scope Rules

适用规则

  • If no file is specified, ask the user which file(s) to lint
  • For globs (e.g.
    docs/*.md
    ), process each file sequentially
  • Only fix
    error
    and
    warning
    by default; include
    suggestion
    if user asks for thorough review
  • 如果未指定文件,询问用户需要lint的文件
  • 对于通配符路径(例如
    docs/*.md
    ),按顺序处理每个文件
  • 默认仅修复
    error
    warning
    等级的问题;如果用户要求全面检查,则同时处理
    suggestion
    等级的问题

What NOT to Fix

禁止修复的内容

  • Domain-specific terminology flagged incorrectly (medical, legal, technical terms)
  • Intentional stylistic choices (e.g. first person in a blog post)
  • Code blocks and frontmatter — Vale should already skip these, but double-check
  • 被误标记的领域特定术语(医疗、法律、技术术语)
  • 有意为之的风格选择(例如博客文章中使用第一人称)
  • 代码块和前置元数据 —— Vale默认会跳过这些内容,但仍需二次确认