Skip to content

Commit

Permalink
Add style workflow (#3909)
Browse files Browse the repository at this point in the history
* Tweak rules

Signed-off-by: Fanit Kolchina <[email protected]>

* Rule changes

Signed-off-by: Fanit Kolchina <[email protected]>

* Remove the following and simple

Signed-off-by: Fanit Kolchina <[email protected]>

* Revised rules and added tests

Signed-off-by: Fanit Kolchina <[email protected]>

* Soft rollout with only spelling and terms

Signed-off-by: Fanit Kolchina <[email protected]>

* Add Vale to readme

Signed-off-by: Fanit Kolchina <[email protected]>

* Only lint modified and added files

Signed-off-by: Fanit Kolchina <[email protected]>

* Remove run on workflow dispatch

Signed-off-by: Fanit Kolchina <[email protected]>

* Removed only added and modified files

Signed-off-by: Fanit Kolchina <[email protected]>

* Added please

Signed-off-by: Fanit Kolchina <[email protected]>

* Changed min alert level to warning

Signed-off-by: Fanit Kolchina <[email protected]>

* Don't fail on error and minor changes

Signed-off-by: Fanit Kolchina <[email protected]>

* Remove fail on error

Signed-off-by: Fanit Kolchina <[email protected]>

* Attempt to have vale not fail

Signed-off-by: Fanit Kolchina <[email protected]>

* Fixed links

Signed-off-by: Fanit Kolchina <[email protected]>

* Update README.md

Co-authored-by: Nathan Bower <[email protected]>
Signed-off-by: kolchfa-aws <[email protected]>

* Update README.md

Co-authored-by: Nathan Bower <[email protected]>
Signed-off-by: kolchfa-aws <[email protected]>

---------

Signed-off-by: Fanit Kolchina <[email protected]>
Signed-off-by: kolchfa-aws <[email protected]>
Co-authored-by: Nathan Bower <[email protected]>
  • Loading branch information
kolchfa-aws and natebower authored May 3, 2023
1 parent 0235af5 commit c9da6c0
Show file tree
Hide file tree
Showing 64 changed files with 1,053 additions and 7 deletions.
71 changes: 71 additions & 0 deletions .github/vale/styles/OpenSearch/AcronymParentheses.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
extends: conditional
message: "'%s': Spell out acronyms the first time that you use them on a page and follow them with the acronym in parentheses. Subsequently, use the acronym alone."
link: 'https://github.com/opensearch-project/documentation-website/blob/main/STYLE_GUIDE.md#acronyms'
level: warning
scope: summary
ignorecase: false
# Ensures that the existence of 'first' implies the existence of 'second'.
first: '\b([A-Z]{1,3}\/?[A-Z]{1,3}\d{0,2})\b'
second: '(?:\b[A-Za-z-]+ )+\(([A-Z]{1,3}\/?[A-Z]{1,3}\d{0,2})\)'
# ... with the exception of these:
exceptions:
- API
- ASCII
- BASIC
- BM25
- CPU
- DOS
- FAQ
- FTP
- GIF
- HTML
- HTTP
- HTTPS
- I/O
- ID
- IP
- JPEG
- JSON
- NAT
- NGINX
- PDF
- RAM
- REST
- RGB
- ROM
- SAML
- SDK
- SSL
- TCP
- TIFF
- TLS
- UI
- URI
- URL
- UTC
- UTF
- XML
- YAML
- CAT
- GET
- PUT
- POST
- DELETE
- AND
- OR
- KB
- MB
- GB
- TB
- PB
- US
- PNG
- JVM
- N/A
- GROUP
- BY
- SELECT
- HAVING
- SQL
- TOC
- 'NULL'
8 changes: 8 additions & 0 deletions .github/vale/styles/OpenSearch/AdverbsOfTime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends: existence
message: "Don't use a comma after single-word adverbs of time at the beginning of a sentence in '%s'."
link: https://github.com/opensearch-project/documentation-website/blob/main/STYLE_GUIDE.md#punctuation-and-capitalization
level: error
ignorecase: false
nonword: true
tokens:
- '(?:(^|\s)(Then|Afterward|Later|Subsequently)),'
6 changes: 6 additions & 0 deletions .github/vale/styles/OpenSearch/Ampersand.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extends: existence
message: "Don't use an ampersand in place of 'and' in documentation."
nonword: true
level: warning
tokens:
- '\w +& +\w'
5 changes: 5 additions & 0 deletions .github/vale/styles/OpenSearch/Cyber.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extends: existence
message: "Use 'cyber' as a prefix. Remove spaces or hyphens in '%s'."
level: error
tokens:
- '[Cc]yber[- ]+[a-z]*'
7 changes: 7 additions & 0 deletions .github/vale/styles/OpenSearch/DashSpacing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: existence
message: "There should be no spaces around the dash in '%s'."
ignorecase: true
nonword: true
level: error
tokens:
- '\w+ +-{2,3} +\w+'
22 changes: 22 additions & 0 deletions .github/vale/styles/OpenSearch/DirectionAboveBelow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
extends: substitution
message: "Use '%s' instead of '%s' for versions or orientation within a document. Use 'above' and 'below' only for physical space or screen descriptions."
link: 'https://github.com/opensearch-project/documentation-website/blob/main/TERMS.md'
level: warning
ignorecase: true
swap:
- 'image below': 'following image'
- 'example below': 'following example'
- 'steps below': 'following steps'
- 'section below': 'following section'
- 'table below': 'following table'
- 'image above': 'following image'
- 'example above': 'preceding example'
- 'section above': 'preceding section'
- 'table above': 'preceding table'
- 'above image': 'preceding image'
- 'above section': 'preceding section'
- 'above table': 'preceding table'
- '\d+\.\d+\s+(?:and|or)\s+above': 'later'
- '\d+\.\d+\s+(?:and|or)\s+below': 'earlier'
- 'below(?!\s+(?:the|this|\d))': 'previous, preceding, or earlier'
- 'above(?!\s+(?:the|this|\d))': 'following or later'
16 changes: 16 additions & 0 deletions .github/vale/styles/OpenSearch/DirectionTopBottom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
extends: substitution
message: "Use '%s' instead of '%s' for window, page, or pane references to features or controls. Use 'top' and 'bottom' only as a general screen reference."
link: 'https://github.com/opensearch-project/documentation-website/blob/main/TERMS.md'
level: warning
ignorecase: true
action:
name: replace
swap:
- top left: upper left
- bottom left: lower left
- top right: upper right
- bottom right: lower right
- top-left: upper-left
- bottom-left: lower-left
- top-right: upper-right
- bottom-right: lower-right
6 changes: 6 additions & 0 deletions .github/vale/styles/OpenSearch/Exclamation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extends: existence
message: "Don't use exclamation points in documentation."
nonword: true
level: error
tokens:
- '\w+!(?:\s|$)'
7 changes: 7 additions & 0 deletions .github/vale/styles/OpenSearch/FailoverNoun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: sequence
message: "Use 'failover' as an adjective or noun instead of '%s'."
level: error
ignorecase: true
tokens:
- tag: NN|JJ
pattern: '(?:fail over|fail-over)'
7 changes: 7 additions & 0 deletions .github/vale/styles/OpenSearch/FailoverVerb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: sequence
message: "Use 'fail over' as a verb instead of '%s'."
level: error
ignorecase: true
tokens:
- tag: VB|VBD|VBG|VBN|VBP|VBZ
pattern: '(?:failover|fail-over)'
7 changes: 7 additions & 0 deletions .github/vale/styles/OpenSearch/FutureTense.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: existence
message: "'%s' is in future tense. Use present tense in documentation."
ignorecase: true
level: suggestion
scope: raw
tokens:
- '(?:will|is going to|won''t|[A-za-z]+''ll)\s+[a-z]+'
11 changes: 11 additions & 0 deletions .github/vale/styles/OpenSearch/HeadingAcronyms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
extends: existence
message: "'%s': Don't define acronyms in headings."
link: 'https://github.com/opensearch-project/documentation-website/blob/main/STYLE_GUIDE.md#acronyms'
level: error
ignorecase: false
scope: heading
nonword: true
action:
name: remove
tokens:
- '\([A-Z]{2,5}\)'
5 changes: 5 additions & 0 deletions .github/vale/styles/OpenSearch/HeadingCapitalization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extends: capitalization
message: "'%s' is a heading and should be in sentence case."
level: error
scope: heading
match: $sentence
7 changes: 7 additions & 0 deletions .github/vale/styles/OpenSearch/HeadingColon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: existence
message: "Capitalize the word after a colon in '%s'."
nonword: true
level: error
scope: heading
tokens:
- '(?::\s)[a-z]+'
9 changes: 9 additions & 0 deletions .github/vale/styles/OpenSearch/HeadingPunctuation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extends: existence
message: "Don't use punctuation at the end of a heading."
nonword: true
level: error
scope: heading
action:
name: remove
tokens:
- '[.?!]$'
17 changes: 17 additions & 0 deletions .github/vale/styles/OpenSearch/Inclusive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
extends: substitution
message: "Use '%s' instead of '%s' because the latter is an offensive term."
link: https://github.com/opensearch-project/documentation-website/blob/main/STYLE_GUIDE.md#offensive-terms
ignorecase: true
level: error
swap:
'abort': stop, end, or cancel
'black day': blocked day
'blacklist': deny list
'execute': run, process, apply, start, launch, or initiate
'hang': stop responding
'kill': stop, end, clear, remove, or cancel
'master account': 'management account'
'master': cluster manager
'slave': replica, secondary, standby
'white day': open day
'whitelist': allow list
10 changes: 10 additions & 0 deletions .github/vale/styles/OpenSearch/LatinismsElimination.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends: existence
message: "Using '%s' is unnecessary. Remove."
link: https://github.com/opensearch-project/documentation-website/blob/main/STYLE_GUIDE.md#basic-guidelines
ignorecase: true
nonword: true
level: warning
action:
name: remove
tokens:
- '\b(?:etc\.|etc)'
15 changes: 15 additions & 0 deletions .github/vale/styles/OpenSearch/LatinismsSubstitution.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
extends: substitution
message: "Use '%s' instead of '%s'."
link: https://github.com/opensearch-project/documentation-website/blob/main/STYLE_GUIDE.md#basic-guidelines
ignorecase: true
level: warning
nonword: true
action:
name: replace
swap:
'\b(?:eg|e\.g\.)[\s,]': for example or such as
'\b(?:ie|i\.e\.)[\s,]': that is or specifically
'ad hoc': one-time
'\b(?:v\.|vs\.|vs|versus)': compared to or compared with
'via': using, through, by accessing, or by choosing
'vice versa': the other way around
7 changes: 7 additions & 0 deletions .github/vale/styles/OpenSearch/LinksEndSlash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: existence
message: "Add a trailing slash to the link '%s'."
level: error
nonword: true
scope: raw
tokens:
- '\(\{\{site.url\}\}\{\{site.baseurl\}\}(\/[A-Za-z0-9-_]+)+\s*\)'
7 changes: 7 additions & 0 deletions .github/vale/styles/OpenSearch/LinksMidSlash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: existence
message: "Add a slash after '{{site.url}}/{{site.baseurl}}' in '%s'."
level: error
nonword: true
scope: raw
tokens:
- '\(\{\{site.url\}\}\{\{site.baseurl\}\}([^\/])(?:(.*))?\)'
7 changes: 7 additions & 0 deletions .github/vale/styles/OpenSearch/LoginNoun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: sequence
message: "Use 'login' as an adjective or noun instead of '%s'."
level: error
ignorecase: true
tokens:
- tag: NN|JJ
pattern: '(?:log in|log-in)'
7 changes: 7 additions & 0 deletions .github/vale/styles/OpenSearch/LoginVerb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: sequence
message: "Use 'log in' as a verb instead of '%s'."
level: error
ignorecase: true
tokens:
- tag: VB|VBD|VBG|VBN|VBP|VBZ
pattern: '(?:login|log into|log on|log onto)'
7 changes: 7 additions & 0 deletions .github/vale/styles/OpenSearch/LogoutNoun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: sequence
message: "Use 'logout' as an adjective or noun instead of '%s'."
level: error
ignorecase: true
tokens:
- tag: NN|JJ
pattern: '(?:log out)'
7 changes: 7 additions & 0 deletions .github/vale/styles/OpenSearch/LogoutVerb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: sequence
message: "Use 'log out' as a verb instead of '%s'."
level: error
ignorecase: true
tokens:
- tag: VB|VBD|VBG|VBN|VBP|VBZ
pattern: '(?:logout)'
6 changes: 6 additions & 0 deletions .github/vale/styles/OpenSearch/MergeConflicts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extends: existence
message: "Resolve lingering merge conflicts."
nonword: true
level: error
tokens:
- '<<<<<<< HEAD'
7 changes: 7 additions & 0 deletions .github/vale/styles/OpenSearch/OxfordComma.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: existence
message: "Add an Oxford comma in '%s'."
scope: sentence
level: warning
nonword: true
tokens:
- '(?:[^\s,]+,){1,} \w+ (?:and|or) \w+[.?!]'
45 changes: 45 additions & 0 deletions .github/vale/styles/OpenSearch/PassiveVoice.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
extends: existence
message: "'%s': Whenever possible, use the active voice instead of the passive voice."
ignorecase: true
level: suggestion
raw:
- \b(am|are|were|being|is|been|was|be)\b\s*
tokens:
- '[\w]+ed'
- become
- been
- begun
- brought
- built
- cast
- caught
- chosen
- come
- cut
- dealt
- done
- drawn
- forbidden
- found
- given
- gone
- gotten
- held
- hidden
- kept
- known
- led
- let
- made
- put
- quit
- read
- seen
- sent
- sped
- spent
- stuck
- swept
- taken
- understood
- written
9 changes: 9 additions & 0 deletions .github/vale/styles/OpenSearch/Please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extends: existence
message: "Using '%s' is unnecessary. Remove."
link: https://github.com/opensearch-project/documentation-website/blob/main/TERMS.md
ignorecase: true
level: warning
action:
name: remove
tokens:
- 'please'
7 changes: 7 additions & 0 deletions .github/vale/styles/OpenSearch/Range.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: existence
message: "Use an en dash (--) with no space on either side in a range of numbers."
link: https://github.com/opensearch-project/documentation-website/blob/main/STYLE_GUIDE.md#numbers-and-measurement
nonword: true
level: error
tokens:
- '\b\d+ *[-] *\d+\b'
6 changes: 6 additions & 0 deletions .github/vale/styles/OpenSearch/Repetition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extends: repetition
message: "'%s' is repeated."
level: error
alpha: true
tokens:
- '[^\s]+'
Loading

0 comments on commit c9da6c0

Please sign in to comment.