sapegin / textlint-rule-stop-words

Textlint rule to find filler words, buzzwords and clichés
MIT License
20 stars 6 forks source link

"ie" in the middle of a word is failing on "large" inputs with CRLF #5

Closed ojohnny closed 1 year ago

ojohnny commented 5 years ago

I'm not sure if this is a textlint bug or a textlint-rule-stop-words bug, but I guess I'll report it here first.

I have a .textlintrc.yml containing:

rules:
  stop-words: true

and sample.txt, which only contains the "real" word identifier at line 1218, and a lot of other dummy words (e.g. "xxxxxx") which should not trigger anything. The file is using CRLF as line endings.

With this setup, textlint fails with the following message:

  1218:93  ✓ error  Avoid using “ie”, use “that is” instead  stop-words

✖ 1 problem (1 error, 0 warnings)
✓ 1 fixable problem.
Try to run: $ textlint --fix [file]

If I add a linebreak at 1218 (so identifier is on line 1219), then the textlint passes. If I change the file to use LF line endings (instead of CRLF), then textlint passes. I have no idea if this is because of the CRLF itself, or if the word is simply at the "wrong" byte offset to trigger the error.

Other occurances of the word identifier in the file does not seem to trigger this error, only the specific occurance at line 1218.

This is on a Windows 7 machine using textlint 11.2.5 and textlint-rule-stopwords 1.0.13.

Coleej commented 5 years ago

I am having a similar problem. Textlint is informing me to change out individual letters which wouldn't even result in a word. For example,

stop-words: Avoid using “i”, use “n” instead

This suggestion is given for the work "It" and goes away if I change it to "nt".

Seems like I might have it misconfigured, but I have very simple textlintrc

"stop-words": { "defaultWords": true, "words": [ "because of", "in order to" ], "exclude": [ "negligible" ] },

sapegin commented 5 years ago

This issue seems to be Windows or CRLF specific, I've never seen this myself on a Mac. And you're right: it may be an issue in Textlint itself (though I did a quick search and haven't found anything).

Feel free to send a pull request with a fix.