textlint-rule / textlint-rule-unexpanded-acronym

textlint rule that check unexpanded acronym.
MIT License
9 stars 3 forks source link

Error report is not showing line number #3

Open amimas opened 5 years ago

amimas commented 5 years ago

I am trying out this rule and really like it so far. It gives me an error report like this:

/Users/amimas/my-project/docs/deploy/index.md
  1:1  error  "URL" is unexpanded acronym. What does "URL" stand for?    unexpanded-acronym
  1:1  error  "CIDR" is unexpanded acronym. What does "CIDR" stand for?  unexpanded-acronym
  1:1  error  "CPU" is unexpanded acronym. What does "CPU" stand for?    unexpanded-acronym
  1:1  error  "JMX" is unexpanded acronym. What does "JMX" stand for?    unexpanded-acronym
  1:1  error  "JVM" is unexpanded acronym. What does "JVM" stand for?    unexpanded-acronym
  1:1  error  "IDE" is unexpanded acronym. What does "IDE" stand for?    unexpanded-acronym
  1:1  error  "DNS" is unexpanded acronym. What does "DNS" stand for?    unexpanded-acronym

The 1:1 is a bit misleading. For other textlint rules this represents the line number where the issue is found but in this rule, it's always 1:1. This can cause confusion too.

I think it's not reporting line number because the acronym can be expanded anywhere in the document, as I understood from the ReadMe of this repo. Ideally an acronym should be expanded the very first time it is introduced in that document. For example, it does not make sense to introduce an acronym at the beginning and explain it later in the document. If we take this approach, then we can probably accurately show a line number in the error report because it will be the first occurrence of the acronym.