get-alex / alex

Catch insensitive, inconsiderate writing
https://alexjs.com
MIT License
4.81k stars 208 forks source link

warning: Named character references must be known #315

Closed raddessi closed 3 years ago

raddessi commented 3 years ago

Subject of the issue

When running over a file with the contents:

if false >/dev/null 2>&1; then
fi

Alex gives an error in a nonstandard format:

testfile
  1:24  warning  Named character references must be known

⚠ 1 warning```

I have tried to track down the cause of this but have not had any luck in a quick search.

Your environment

Steps to reproduce

Working example info is above.

Expected behaviour

Either an error should be raised in the normal format so it can be fixed or ignored, or the ampersand should just not cause issues?

Actual behaviour

It seems like something fails when reading the ampersand character.

wooorm commented 3 years ago

You shouldn’t run alex’ default (markdown), on non-markdown files. You can pass --text to read input as text.

FWIW, when going through the next wave of dependency updates, this error will be gone!

raddessi commented 3 years ago

Gotcha! I'll update to the and see what changes. Thanks

raddessi commented 3 years ago

Ahh that totally fixes it. OK, I get what is going on. From my first read of the docs I had assumed that alex was doing a file identification automatically and that the --text etc flags were to override that automatic identification only. Thanks for the advice! It works as expected on scripts now :)