Closed SheetJSDev closed 7 years ago
The stuff you need to add to allow
is this:
1:1-1:4 warning Don’t use “WTF”, it’s profane wtf retext-profanities.
So if you see a warning, add that part (the rule identifier) to allow. Due to technicalities, it’s not easy to allow any value in there, but I’m definitely for better docs! Do you have a suggestion what to add where?
Following the example from https://github.com/wooorm/alex#command-line , the README currently claims the output for the example.md
is:
example.md
1:5-1:14 warning `boogeyman` may be insensitive, use `boogey` instead boogeyman-boogeywoman
1:42-1:48 warning `master` / `slaves` may be insensitive, use `primary` / `replica` instead master-slave
2:52-2:54 warning `he` may be insensitive, use `they`, `it` instead he-she
2:61-2:68 warning `cripple` may be insensitive, use `person with a limp` instead cripple
⚠ 4 warnings
Running against the current version, I see:
$ alex example.md
example.md
1:5-1:14 warning `boogeyman` may be insensitive, use `boogey` instead boogeyman-boogeywoman retext-equality
1:42-1:48 warning `master` / `slaves` may be insensitive, use `primary` / `replica` instead master-slave retext-equality
1:69-1:75 warning Don’t use “slaves”, it’s profane slaves retext-profanities
2:52-2:54 warning `he` may be insensitive, use `they`, `it` instead he-she retext-equality
2:61-2:68 warning `cripple` may be insensitive, use `person with a limp` instead cripple retext-equality
⚠ 5 warnings
$ alex example.md
example.md
name message source rule id
1:5-1:14 warning `boogeyman` may be insensitive, use `boogey` instead boogeyman-boogeywoman retext-equality
1:42-1:48 warning `master` / `slaves` may be insensitive, use `primary` / `replica` instead master-slave retext-equality
1:69-1:75 warning Don’t use “slaves”, it’s profane slaves retext-profanities
2:52-2:54 warning `he` may be insensitive, use `they`, `it` instead he-she retext-equality
2:61-2:68 warning `cripple` may be insensitive, use `person with a limp` instead cripple retext-equality
⚠ 5 warnings
(related question: is there any way to elicit an error
? If not, maybe the whole warning column should be removed)
actual
rather than ruleId
? For example, with WTF
:> require('alex').text('WTF').messages[0]
{ [1:1-1:4: Don’t use “WTF”, it’s profane]
message: 'Don’t use “WTF”, it’s profane',
name: '1:1-1:4',
file: '',
reason: 'Don’t use “WTF”, it’s profane',
line: 1,
column: 1,
location:
{ start: { line: 1, column: 1, offset: 0 },
end: { line: 1, column: 4, offset: 3 } },
ruleId: 'wtf', // <-- this is the rule
source: 'retext-profanities',
fatal: false,
profanitySeverity: 2,
actual: 'WTF', // <-- the actual text is avaiable
expected: null }
Would it be possible to make exemptions that checked the actual
value rather than ruleId
? For example, the exemption !WTF
would match the actual text WTF
In context, the README is describing an option
WTF
, which is an offensive word according to alex. The natural approach would put the offensive word within theallow
block, but it seems to be case sensitive:When the exemption is written in lowercase, everything works:
IMHO the exemptions should be case insensitive, especially for cases like WTF where the offending string is usually written in uppercase.