Skip to content

Commit

Permalink
Add has no effect pattern
Browse files Browse the repository at this point in the history
Closes GH-13.
Closes GH-14.

Reviewed-by: Merlijn Vos <[email protected]>
Reviewed-by: Titus Wormer <[email protected]>
  • Loading branch information
aduh95 authored Aug 19, 2021
1 parent 60e0193 commit d561172
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
5 changes: 4 additions & 1 deletion patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export const patterns = {
replace: ['cheap']
},
effect: {
replace: ['choose', 'pick']
replace: ['choose', 'pick', 'result']
},
'effect modifications': {
replace: ['make changes']
Expand Down Expand Up @@ -426,6 +426,9 @@ export const patterns = {
'has a requirement for': {
replace: ['needs']
},
'has no effect': {
replace: ['does nothing', 'does not apply']
},
herein: {
replace: ['here']
},
Expand Down
16 changes: 15 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {retext} from 'retext'
import retextSimplify from './index.js'

test('retext-simplify', (t) => {
t.plan(4)
t.plan(5)

retext()
.use(retextSimplify)
Expand Down Expand Up @@ -71,4 +71,18 @@ test('retext-simplify', (t) => {
'should not warn for ignored phrases'
)
}, t.ifErr)

retext()
.use(retextSimplify)
.process('This method has no effect')
.then((file) => {
t.deepEqual(
file.messages.map((d) => String(d)),
[
'1:13-1:26: Replace `has no effect` with `does nothing`, `does not apply`',
'1:20-1:26: Replace `effect` with `choose`, `pick`, `result`'
],
'should warn about simpler synonyms'
)
}, t.ifErr)
})

0 comments on commit d561172

Please sign in to comment.