retextjs / retext-readability

plugin to check readability
https://unifiedjs.com
MIT License
94 stars 8 forks source link

Sureness Threshold Messages Unclear #4

Closed localjo closed 8 years ago

localjo commented 8 years ago

I had a hard time figuring out what the sureness threshold messages meant until I read the code. The possible messages are;

Definitely hard to read sentence
Very hard to read sentence
Quite hard to read sentence

What those really mean is;

6/7 formulas agree that the sentence is hard to read
5/7 formulas agree that the sentence is hard to read
4/7 formulas agree that the sentence is hard to read

To make the messaging more clear, I propose that we add a ruleId and improve the wording of the message. Maybe we could target an end result that looks something like this;

7:1-7:265  error      Hard to read sentence, 85% consensus        difficult-sentence-85
8:1-8:165  warning    Hard to read sentence, 70% consensus        difficult-sentence-70
9:1-9:65   warning    Hard to read sentence,  60% consensus       difficult-sentence-60

Open to other suggestions. The "error"/"warning" level is another question altogether, but I put it in my example just to illustrate more how it could be used.

localjo commented 8 years ago

The added benefit of giving each threshold a different ruleId would be that the messages could be turned off/on or given a different error/warning level based on which threshold they hit.

localjo commented 8 years ago

To be consistent with the way things work currently, here's another potential target:

7:1-7:265  warning    Hard to read sentence, Threshold 6/7        hard-to-read-6
8:1-8:165  warning    Hard to read sentence, Threshold 5/7        hard-to-read-5
9:1-9:65   warning    Hard to read sentence, Threshold 4/7        hard-to-read-4
wooorm commented 8 years ago

OK, thinking out loud here, these are my initial feels:

I also think that your initial issues sort-of poses an XY-problem: the messages are unclear, but instead of just changing the messages, you propose adding a ruleId, which will make it possible to write code which does that. I think changing the messages / adding sureness accomplishes this as well!?

localjo commented 8 years ago

Makes sense. Especially about the ruleId. I didn't think about the message-control scenario. Maybe we can just add one ruleId for all of them? retext-readability or just readability?

For the errors, I'm just thinking it would be nice to have different severity levels for the messages, not that it would be a thread-stopping error. I've currently got a workaround in quality-docs that does this, and it works nicely. But that's probably an extensive change across lots of plugins and really it's a different issue anyway.

I'm wrapping up for the day, but I think tomorrow I'll create a PR that does the following;

How's that sound?

wooorm commented 8 years ago

Good!

  1. πŸ‘
  2. πŸ‘ - Same as source, seems logical for plugins with just one rule (PS ruleId can be passed as a third argument to warn())

And related to severities: https://github.com/wooorm/remark-lint/issues/65.