Skip to content

Commit 2b261a8

Browse files
committed
feat(rule): refactor alternatives
1 parent f9faa6f commit 2b261a8

16 files changed

+102
-153
lines changed

Diff for: Prim/RequiredAlternatives.yml renamed to Prim/Consistency.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
extends: substitution
22
message: "Use '%s' instead of '%s'."
3-
level: error
3+
level: warning
44
ignorecase: true
55
action:
66
name: replace
77
swap:
88
24/7: 24x7
99
3\-D: 3D
10-
Ajax: AJAX
1110
audio(?:-| )books?: audiobook|audiobooks
1211
autodetect: auto-detect
1312
back(?:-| )light: backlight
1413
back\s(slash|slashes): backslash|backslashes
15-
'[bB]asic [aA]uth': Basic HTTP authentication|Basic authentication
1614
bottle(?:-| )necks?: bottleneck|bottlenecks
17-
(?:cell ?phone|smart ?phone): phone|mobile phone
1815
chat(?:-| )bots?: chatbot|chatbots
1916
check lists?: checklist|checklists
2017
check marks?: checkmark|checkmarks
@@ -28,7 +25,9 @@ swap:
2825
(?:OAuth ?2|Oauth): OAuth 2.0
2926
ok: OK
3027
on demand: on-demand
28+
open-source: open source
3129
(?:file ?path|path ?name)s?: path|paths
30+
(?:cell ?phone|smart ?phone): phone|mobile phone
3231
(?:quote mark|quotemark)s?: quotation mark|quotation marks
3332
scroll(?:-| )bars?: scrollbar|scrollbars
3433
synch: sync
@@ -38,3 +37,4 @@ swap:
3837
an URL: a URL
3938
usecases?: use case|use cases
4039
(?:WiFi|wifi): Wi-Fi
40+
World Wide Web: web

Diff for: Prim/PreferredAlternatives.yml

-18
This file was deleted.

Diff for: Prim/SimplerAlternatives.yml renamed to Prim/Simplifications.yml

+4
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,9 @@ ignorecase: true
55
action:
66
name: replace
77
swap:
8+
0-days?: zero-day|zero-days
9+
12 am: midnight
10+
12 pm: noon
11+
adversely impact: hurt
812
approximately: about|around
913
state-of-the-art: modern|latest

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "prim",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "A Vale-compatible prose style for non-native English speaker",
55
"type": "module",
66
"author": "Naiyer Asif (https://naiyerasif.com)",

Diff for: test/fixtures/SimplerAlternatives/.vale.ini renamed to test/fixtures/Consistency/.vale.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ StylesPath = ../../../
33
MinAlertLevel = suggestion
44

55
[*.md]
6-
Prim.SimplerAlternatives = YES
6+
Prim.Consistency = YES

Diff for: test/fixtures/RequiredAlternatives/test.md renamed to test/fixtures/Consistency/test.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
# Required Alternatives
1+
# Consistency
22

33
<!-- 24/7 -->
44
Our emergency hotline is staffed 24/7 for immediate assistance.
55

66
<!-- 3-D -->
77
The movie was stunning in 3-D.
88

9-
<!-- Ajax -->
10-
The web developer used Ajax to create a dynamic search feature on the website.
11-
129
<!-- audiobook -->
1310
I use audio-books to learn new languages.
1411
This audio book is several hours long.
@@ -24,19 +21,12 @@ This phone can automatically adjust the back-light brightness.
2421
Press back slash to reset the search.
2522
On Windows, we use back slashes to separate directories and files.
2623

27-
<!-- Basic authentication -->
28-
Basic Auth requires a username and password to authenticate requests.
29-
3024
<!-- bottleneck -->
3125
The bottle necks in production caused delays.
3226
The narrow hallway creates a bottle-neck during rush hours.
3327

34-
<!-- phone -->
35-
I use my cell phone to take pictures.
36-
Keep your smartphone on airplane mode during the flight.
37-
38-
<!-- chatbot -->
39-
A chat-bot is a conversational agent that simulates human conversation.
28+
<!-- chat bot -->
29+
She used a chat bot to proofread her paper.
4030
Chat bots can be trained to analyze data and provide insights.
4131

4232
<!-- check list -->
@@ -81,10 +71,17 @@ I prefer watching movies on demand.
8171
<!-- OK -->
8272
Is everything ok?
8373

74+
<!-- open-source -->
75+
I contributed a new feature to an open-source project.
76+
8477
<!-- path -->
8578
Check the file path to locate the document.
8679
Copy and paste the full path names to navigate to the desired folder.
8780

81+
<!-- phone -->
82+
Have you seen my cell phone?
83+
My smartphone is running low on battery.
84+
8885
<!-- quotation mark -->
8986
You can use quote marks to format in-text citations.
9087
Use quotemark to set off a quotation from the text.
@@ -112,3 +109,6 @@ We analyzed the usecases to identify potential improvements.
112109
<!-- wifi -->
113110
The cafe offers free wifi for customers.
114111
I can't finish my work without WiFi.
112+
113+
<!-- World Wide Web -->
114+
I'd better search the World Wide Web for a new recipe.

Diff for: test/fixtures/PreferredAlternatives/.vale.ini

-6
This file was deleted.

Diff for: test/fixtures/PreferredAlternatives/test.md

-36
This file was deleted.

Diff for: test/fixtures/SimplerAlternatives/test.md

-7
This file was deleted.

Diff for: test/fixtures/RequiredAlternatives/.vale.ini renamed to test/fixtures/Simplifications/.vale.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ StylesPath = ../../../
33
MinAlertLevel = suggestion
44

55
[*.md]
6-
Prim.RequiredAlternatives = YES
6+
Prim.Simplifications = YES

Diff for: test/fixtures/Simplifications/test.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Simplifications
2+
3+
<!-- 0-day -->
4+
A hacker forum was found selling a 0-day exploit for a popular web browser.
5+
Security researchers discovered critical 0-days in the operating system.
6+
7+
<!-- 12 am -->
8+
Our online support is available until 12 am.
9+
10+
<!-- 12 pm -->
11+
Please submit your report by 12 pm tomorrow.
12+
13+
<!-- adversely impact -->
14+
The new regulations may adversely impact small businesses.
15+
16+
<!-- approximately -->
17+
The population of the city is approximately 1 million people.
18+
19+
<!-- state-of-the-art -->
20+
This state-of-the-art arena can host 7,000 fans.

Diff for: test/snapshots/Consistency.log

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
test.md:4:34:Prim.Consistency:Use '24x7' instead of '24/7'.
2+
test.md:7:27:Prim.Consistency:Use '3D' instead of '3-D'.
3+
test.md:10:7:Prim.Consistency:Use 'audiobook' or 'audiobooks' instead of 'audio-books'.
4+
test.md:11:6:Prim.Consistency:Use 'audiobook' or 'audiobooks' instead of 'audio book'.
5+
test.md:14:14:Prim.Consistency:Use 'auto-detect' instead of 'autodetect'.
6+
test.md:17:24:Prim.Consistency:Use 'backlight' instead of 'back light'.
7+
test.md:18:41:Prim.Consistency:Use 'backlight' instead of 'back-light'.
8+
test.md:21:7:Prim.Consistency:Use 'backslash' or 'backslashes' instead of 'back slash'.
9+
test.md:22:20:Prim.Consistency:Use 'backslash' or 'backslashes' instead of 'back slashes'.
10+
test.md:25:5:Prim.Consistency:Use 'bottleneck' or 'bottlenecks' instead of 'bottle necks'.
11+
test.md:26:30:Prim.Consistency:Use 'bottleneck' or 'bottlenecks' instead of 'bottle-neck'.
12+
test.md:29:12:Prim.Consistency:Use 'chatbot' or 'chatbots' instead of 'chat bot'.
13+
test.md:30:1:Prim.Consistency:Use 'chatbot' or 'chatbots' instead of 'Chat bots'.
14+
test.md:33:12:Prim.Consistency:Use 'checklist' or 'checklists' instead of 'check list'.
15+
test.md:34:8:Prim.Consistency:Use 'checklist' or 'checklists' instead of 'check lists'.
16+
test.md:37:17:Prim.Consistency:Use 'checkmark' or 'checkmarks' instead of 'check mark'.
17+
test.md:38:12:Prim.Consistency:Use 'checkmark' or 'checkmarks' instead of 'check marks'.
18+
test.md:41:5:Prim.Consistency:Use 'downtime' instead of 'down time'.
19+
test.md:44:17:Prim.Consistency:Use 'dual-boot' instead of 'dualboot'.
20+
test.md:45:34:Prim.Consistency:Use 'dual-boot' instead of 'dual boot'.
21+
test.md:48:15:Prim.Consistency:Use 'email' instead of 'e-mail'.
22+
test.md:49:1:Prim.Consistency:Use 'email' instead of 'E-mail'.
23+
test.md:52:18:Prim.Consistency:Use 'hardcopy' or 'hardcopies' instead of 'hard copy'.
24+
test.md:53:41:Prim.Consistency:Use 'hardcopy' or 'hardcopies' instead of 'hard copies'.
25+
test.md:56:14:Prim.Consistency:Use 'hard-coded' instead of 'hardcoded'.
26+
test.md:59:12:Prim.Consistency:Use 'HTTPS' instead of 'HTTPs'.
27+
test.md:62:25:Prim.Consistency:Use 'in-depth' instead of 'in depth'.
28+
test.md:65:14:Prim.Consistency:Use 'OAuth 2.0' instead of 'OAuth'.
29+
test.md:66:1:Prim.Consistency:Use 'OAuth 2.0' instead of 'Oauth'.
30+
test.md:69:26:Prim.Consistency:Use 'on-demand' instead of 'on demand'.
31+
test.md:72:15:Prim.Consistency:Use 'OK' instead of 'ok'.
32+
test.md:75:35:Prim.Consistency:Use 'open source' instead of 'open-source'.
33+
test.md:78:11:Prim.Consistency:Use 'path' or 'paths' instead of 'file path'.
34+
test.md:79:25:Prim.Consistency:Use 'path' or 'paths' instead of 'path names'.
35+
test.md:82:18:Prim.Consistency:Use 'phone' or 'mobile phone' instead of 'cell phone'.
36+
test.md:83:4:Prim.Consistency:Use 'phone' or 'mobile phone' instead of 'smartphone'.
37+
test.md:86:13:Prim.Consistency:Use 'quotation mark' or 'quotation marks' instead of 'quote marks'.
38+
test.md:87:5:Prim.Consistency:Use 'quotation mark' or 'quotation marks' instead of 'quotemark'.
39+
test.md:90:9:Prim.Consistency:Use 'scrollbar' or 'scrollbars' instead of 'scroll bar'.
40+
test.md:91:24:Prim.Consistency:Use 'scrollbar' or 'scrollbars' instead of 'scroll-bars'.
41+
test.md:94:19:Prim.Consistency:Use 'sync' instead of 'synch'.
42+
test.md:97:5:Prim.Consistency:Use 'test case' or 'test cases' instead of 'testcase'.
43+
test.md:98:76:Prim.Consistency:Use 'test case' or 'test cases' instead of 'testcases'.
44+
test.md:101:17:Prim.Consistency:Use 'URL' instead of 'url'.
45+
test.md:102:5:Prim.Consistency:Use 'URL of' instead of 'URL for'.
46+
test.md:103:10:Prim.Consistency:Use 'a URL' instead of 'an URL'.
47+
test.md:106:28:Prim.Consistency:Use 'use case' or 'use cases' instead of 'usecase'.
48+
test.md:107:17:Prim.Consistency:Use 'use case' or 'use cases' instead of 'usecases'.
49+
test.md:110:22:Prim.Consistency:Use 'Wi-Fi' instead of 'wifi'.
50+
test.md:111:32:Prim.Consistency:Use 'Wi-Fi' instead of 'WiFi'.
51+
test.md:114:23:Prim.Consistency:Use 'web' instead of 'World Wide Web'.

Diff for: test/snapshots/PreferredAlternatives.log

-13
This file was deleted.

Diff for: test/snapshots/RequiredAlternatives.log

-51
This file was deleted.

Diff for: test/snapshots/SimplerAlternatives.log

-2
This file was deleted.

Diff for: test/snapshots/Simplifications.log

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
test.md:4:36:Prim.Simplifications:Use 'zero-day' or 'zero-days' instead of '0-day'.
2+
test.md:5:42:Prim.Simplifications:Use 'zero-day' or 'zero-days' instead of '0-days'.
3+
test.md:8:39:Prim.Simplifications:Use 'midnight' instead of '12 am'.
4+
test.md:11:30:Prim.Simplifications:Use 'noon' instead of '12 pm'.
5+
test.md:14:25:Prim.Simplifications:Use 'hurt' instead of 'adversely impact'.
6+
test.md:17:31:Prim.Simplifications:Use 'about' or 'around' instead of 'approximately'.
7+
test.md:20:6:Prim.Simplifications:Use 'modern' or 'latest' instead of 'state-of-the-art'.

0 commit comments

Comments
 (0)