Skip to content

Commit f7ca97e

Browse files
feat(core): add allows keyword to Weir (#2602)
* feat(core): add `ignores` test syntax to Weir * feat(core): explicitely fail if the lint count is greater than zero on equivalent strings * docs(core): document `ignores` keyword * refactor(core): replace exising tests with use of `ignores` * refactor(core): change from `ignores` -> `allows` * refactor(core): align other idents
1 parent f5ba1ea commit f7ca97e

47 files changed

Lines changed: 287 additions & 214 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

harper-core/src/linting/weir_rules/AOkHyphen.weir

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test "You were totally a ok host." "You were totally a-ok host."
2323
test "Being a ok line of communication matters." "Being a-ok line of communication matters."
2424
test "It has been a ok solution in the past." "It has been a-ok solution in the past."
2525

26-
test "The dashboard shows A-OK feedback." "The dashboard shows A-OK feedback."
27-
test "Our status is OK." "Our status is OK."
28-
test "This is a good plan." "This is a good plan."
29-
test "AOK signals readiness." "AOK signals readiness."
26+
allows "The dashboard shows A-OK feedback."
27+
allows "Our status is OK."
28+
allows "This is a good plan."
29+
allows "AOK signals readiness."

harper-core/src/linting/weir_rules/AllOfASudden.weir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ test "He whispered, \"all the sudden we were alone.\"" "He whispered, \"all of a
1414
test "ALL THE SUDDEN THE ROOM WENT DARK." "ALL OF A SUDDEN THE ROOM WENT DARK."
1515
test "They were laughing all the sudden." "They were laughing all of a sudden."
1616
test "It stormed all of sudden after a warm morning." "It stormed all of a sudden after a warm morning."
17-
test "Their excitement and suddenness were all the suddenness she remembered." "Their excitement and suddenness were all the suddenness she remembered."
17+
allows "Their excitement and suddenness were all the suddenness she remembered."
1818
test "This all the sudden change surprised everyone." "This all of a sudden change surprised everyone."

harper-core/src/linting/weir_rules/Alongside.weir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ test "The skiff pulled along side." "The skiff pulled alongside."
1212
test "\"We drifted along side,\" she said." "\"We drifted alongside,\" she said."
1313
test "They stood along side, waiting patiently." "They stood alongside, waiting patiently."
1414
test "Cars lined up along side the curb." "Cars lined up alongside the curb."
15-
test "They walked alongside the river." "They walked alongside the river."
16-
test "They walked along the side of the river." "They walked along the side of the river."
17-
test "We camped along the lakeside all weekend." "We camped along the lakeside all weekend."
15+
allows "They walked alongside the river."
16+
allows "They walked along the side of the river."
17+
allows "We camped along the lakeside all weekend."

harper-core/src/linting/weir_rules/AsFollows.weir

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ test "Is this description as follow the sample?" "Is this description as follows
1717
test "You can verify as follow once the build completes." "You can verify as follows once the build completes."
1818

1919
# Ensure unrelated uses of "follow" are not affected
20-
test "Follow the instructions as written." "Follow the instructions as written."
21-
test "We follow-up on these requests weekly." "We follow-up on these requests weekly."
22-
test "This is the way to follow as best you can." "This is the way to follow as best you can."
23-
test "As follows the plan will unfold." "As follows the plan will unfold."
24-
test "I will follow your lead." "I will follow your lead."
25-
test "The as follows section is helpful." "The as follows section is helpful."
20+
allows "Follow the instructions as written."
21+
allows "We follow-up on these requests weekly."
22+
allows "This is the way to follow as best you can."
23+
allows "As follows the plan will unfold."
24+
allows "I will follow your lead."
25+
allows "The as follows section is helpful."

harper-core/src/linting/weir_rules/Beforehand.weir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ let becomes "beforehand"
66

77
test "Let me know before hand if you will attend." "Let me know beforehand if you will attend."
88
test "I prepared the documents before-hand." "I prepared the documents beforehand."
9-
test "We finished the preparations beforehand." "We finished the preparations beforehand."
9+
allows "We finished the preparations beforehand."

harper-core/src/linting/weir_rules/BewareOf.weir

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ test "Beware among the wild animals outside the park." "Beware of the wild anima
2020
test "Beware between the gaps in the scaffolding." "Beware of the gaps in the scaffolding."
2121
test "BEWARE WITH THE LOUD CRASHING." "BEWARE OF THE LOUD CRASHING."
2222

23-
test "Beware of the dog that guards the porch." "Beware of the dog that guards the porch."
24-
test "Beware the gap between the platforms." "Beware the gap between the platforms."
25-
test "Beware every time you go near the cliff." "Beware every time you go near the cliff."
26-
test "Some people say beware: the path narrows." "Some people say beware: the path narrows."
27-
test "Beware of tall waves on this beach." "Beware of tall waves on this beach."
23+
allows "Beware of the dog that guards the porch."
24+
allows "Beware the gap between the platforms."
25+
allows "Beware every time you go near the cliff."
26+
allows "Some people say beware: the path narrows."
27+
allows "Beware of tall waves on this beach."

harper-core/src/linting/weir_rules/CoursingThroughVeins.weir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ let becomes "coursing through veins"
77

88
test "cursing through veins" "coursing through veins"
99
test "It felt like the drugs were cursing through veins." "It felt like the drugs were coursing through veins."
10-
test "He was cursing through the entire meeting." "He was cursing through the entire meeting."
10+
allows "He was cursing through the entire meeting."

harper-core/src/linting/weir_rules/DoIAdjective.weir

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ test "Do I not interested in attending?" "Am I not interested in attending?"
1818
test "Do I not ready yet?" "Am I not ready yet?"
1919
test "do I concerned about the changes?" "am I concerned about the changes?"
2020

21-
test "Do I want to help you?" "Do I want to help you?"
22-
test "Do I need to finish this tonight?" "Do I need to finish this tonight?"
23-
test "Do I have to explain everything?" "Do I have to explain everything?"
24-
test "Do I run the tests again?" "Do I run the tests again?"
25-
test "Do I look like I'm not listening?" "Do I look like I'm not listening?"
21+
allows "Do I want to help you?"
22+
allows "Do I need to finish this tonight?"
23+
allows "Do I have to explain everything?"
24+
allows "Do I run the tests again?"
25+
allows "Do I look like I'm not listening?"

harper-core/src/linting/weir_rules/DoNotWant.weir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ let becomes ["don't want", "do not want"]
77

88
test "I don't wan to pay for this." "I don't want to pay for this."
99
test "Don't Wan that option." "Don't Want that option."
10-
test "I don't want to leave." "I don't want to leave."
10+
allows "I don't want to leave."

harper-core/src/linting/weir_rules/DoToDueTo.weir

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ test "The app crashed do to memory leaks." "The app crashed due to memory leaks.
1717
test "Tickets sold quickly do to a viral post." "Tickets sold quickly due to a viral post."
1818
test "It failed do to data loss." "It failed due to data loss."
1919

20-
test "What did you do to the file?" "What did you do to the file?"
21-
test "Please do to the file what you did to the other one." "Please do to the file what you did to the other one."
22-
test "Don't do to others what you wouldn't want done to you." "Don't do to others what you wouldn't want done to you."
23-
test "We need to do to this spreadsheet what we did last week." "We need to do to this spreadsheet what we did last week."
24-
test "She asked what the update would do to her settings." "She asked what the update would do to her settings."
20+
allows "What did you do to the file?"
21+
allows "Please do to the file what you did to the other one."
22+
allows "Don't do to others what you wouldn't want done to you."
23+
allows "We need to do to this spreadsheet what we did last week."
24+
allows "She asked what the update would do to her settings."

0 commit comments

Comments
 (0)