Skip to content
30 changes: 15 additions & 15 deletions styles/Canonical/004-Canonical-product-names.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ ignorecase: true
nonword: true
swap:
"(?<=Anbox )Cloud": "Cloud" # Because Anbox is a dictionary term, multi-word capture does not work
Anbox: Anbox
Kubeflow: "Kubeflow"
(?<!<)Anbox(?!>): Anbox
(?<!<)Kubeflow(?!>): "Kubeflow"
"Charmed(?= kubeflow)": "Charmed"
Canononical Observability Stack: Canonical Observability Stack
Juju: Juju
Landscape(?! environment| layout): Landscape
Launchpad: Launchpad
LXD: LXD
MAAS: MAAS
MicroCeph: MicroCeph
MicroCloud: MicroCloud
MicroK8s: MicroK8s
MicroOVN: MicroOVN
MicroStack: MicroStack
Multipass: Multipass
(?<!<)Juju(?!>|\.is): Juju
(?<!<)Landscape(?!>)(?! environment| layout): Landscape
(?<!<)Launchpad(?!>): Launchpad
(?<!<)LXD(?!>): LXD
(?<!<)MAAS(?!>): MAAS
(?<!<)MicroCeph(?!>): MicroCeph
(?<!<)MicroCloud(?!>): MicroCloud
(?<!<)MicroK8s(?!>): MicroK8s
(?<!<)MicroOVN(?!>): MicroOVN
(?<!<)MicroStack(?!>): MicroStack
(?<!<)Multipass(?!>): Multipass
(?<=Canonical )Observability Stack: Observability Stack
Snapcraft: Snapcraft
snapd: snapd # Vale seems to allow normal capitalisation, may need specific existence rule for Snapd
(?<!<)Snapcraft(?!>|\.io): Snapcraft
(?<!<)snapd(?!>): snapd # Vale seems to allow normal capitalisation, may need specific existence rule for Snapd
Ubuntu Core: Ubuntu Core
# \b ensures only "Ubuntu Pro" matches, not "Ubuntu project", "Ubuntu provides", etc.
(?<=Ubuntu )Pro\b: Pro
Expand Down
20 changes: 10 additions & 10 deletions styles/Canonical/013-Spell-out-numbers-below-10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ scope:
- table.cell
level: suggestion
swap:
(?<![-+#*:,.\/]|Day )0(?![-+*:,.\/]): zero
(?<![-+#*:,.\/]|Day )1(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): one
(?<![-+#*:,.\/]|Day )2(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): two
(?<![-+#*:,.\/]|Juju )3(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): three
(?<![-+#*:,.\/])4(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): four
(?<![-+#*:,.\/])5(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): five
(?<![-+#*:,.\/])6(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): six
(?<![-+#*:,.\/])7(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): seven
(?<![-+#*:,.\/])8(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): eight
(?<![-+#*:,.\/])9(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): nine
(?<![-+#*:]\s|[-+#*:,.\/]|Day )0(?![-+*:,.\/]): zero
(?<![-+#*:]\s|[-+#*:,.\/]|Day )1(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): one
(?<![-+#*:]\s|[-+#*:,.\/]|Day )2(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): two
(?<![-+#*:]\s|[-+#*:,.\/]|Juju )3(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): three
(?<![-+#*:]\s|[-+#*:,.\/])4(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): four
(?<![-+#*:]\s|[-+#*:,.\/])5(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): five
(?<![-+#*:]\s|[-+#*:,.\/])6(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): six
(?<![-+#*:]\s|[-+#*:,.\/])7(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): seven
(?<![-+#*:]\s|[-+#*:,.\/])8(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): eight
(?<![-+#*:]\s|[-+#*:,.\/])9(?![-+*:,.\/])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): nine
2 changes: 1 addition & 1 deletion styles/Canonical/015-No-prompts-in-comments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ scope: raw
nonword: true
level: warning
tokens:
- '^[ \t]*[$%]'
- '^[ \t]*[$%] [^\s]+'
4 changes: 2 additions & 2 deletions styles/Canonical/016-No-inline-comments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ level: suggestion
tokens:
- ^```[^\n\{\}]*\n(([^\n`][^\n#]*\n|\n))*([^\n#]+ +#.*\n)+([^\n`]*\n)*```$
- ^```[^\n\{\}]*\n([^\n`][^\n]*\n|\n)*([^\n\/][^\n\/]+ +\/\/.*\n)+([^\n`]*\n)*```$
- '\.\. (?:code-block|code|sourcecode):: ?.*\n(?: {3,}:\w+:\n)*(?:\n| {3,}[^\n#]+\n)*( {3,}[^\n]*#[^\n]*\n)(?:\n| {3,}[^\n#]+\n)*'
- '\.\. (?:code-block|code|sourcecode):: ?.*\n(?: {3,}:\w+:\n)*(?:\n| {3,}[^\n\/\/]+\n)*( {3,}[^\n]* \/\/[^\n]*\n)(?:\n| {3,}[^\n\/\/]+\n)*'
- '(?:\.\. (code-block|code|sourcecode):: ?[^\n]*\n(?: {2,6}:\w+:\n)*?(?:\n| +?[^ \n#][^\n#]+\n)*?)( +?[^ \n][^\n]*?#[^\n]*?\n)'
- '(?:\.\. (code-block|code|sourcecode):: ?[^\n]*\n(?: {2,6}:\w+:\n)*?(?:\n| +?[^\n\/ ][^\n\/]+\n)*?)( +?[^ \n][^\n]* \/\/[^\n]*\n)'
13 changes: 12 additions & 1 deletion styles/config/vocabularies/Canonical/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ANAIS
Anbox
Anbox Cloud
Ansible
APIs
APIs?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, is this a regex ? or a regular ??

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regex, means that it accepts API and APIs

APK
APM
Appium
Expand All @@ -38,7 +38,9 @@ BAU
BOM
BTS
BZR
CA
CAC
Canonical
Canonical Observability Stack
CBR
CDK
Expand All @@ -49,6 +51,7 @@ Charmcraft
Charmed
Charmed Kubeflow
Charmhub
Charmhub Proxy
CISC
CLA
CLI
Expand Down Expand Up @@ -80,6 +83,7 @@ Data Integrator
DBR
DEP
Debian
Dedicated Snap Store
Devel
DHCP
DKMS
Expand All @@ -98,6 +102,7 @@ eksctl
Emmet
Endian
Endianness
Enterprise Store
EoL
EoS
EPMO
Expand All @@ -124,6 +129,7 @@ HA
HAcluster
HAP
HAProxy
High-Availability
Hockeypuck
hostname
HPC
Expand Down Expand Up @@ -188,6 +194,7 @@ Mattermost
MDF
MDL
MEC
Memcached
Mesos
Metallb
MicroCeph
Expand All @@ -198,6 +205,7 @@ MicroOVN
MicroStack
Mir
MLflow
Model Service
Mojo
MongoDB
MOTU
Expand Down Expand Up @@ -241,11 +249,13 @@ OVA
OVAL
OVN
OVS
p11-kit
P4
PCB
PCF
PCKN
PCRE
PDF
PgBouncer
PKCS
PKS
Expand Down Expand Up @@ -289,6 +299,7 @@ SDK
SDR
SDS
SEG
Serial Vault
SFDC
Sidekiq
SIP
Expand Down
48 changes: 38 additions & 10 deletions tests/data/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ rules:
expect:
triggers: []
severity: error
004-Canonical-product-names: # Not currently working for multi-word terms
004-Canonical-product-names:
cases:
- id: canonical-product-names
filetypes: [md, rst]
Expand Down Expand Up @@ -232,6 +232,11 @@ rules:
Ubuntu Server is for data centres.
The Ubuntu project is open source.
Ubuntu provides a range of tools.
Lets try websites:
snapcraft.io is the Snapcraft website.
api.snapcraft.io is the Snapcraft API site.
https://api.snapcraft.io is using a protocol.
Comment on lines +235 to +238
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add a couple of usages with angle brackets, to check that they're not flagged? To exercise the rules and also as representative of real docs (I'm curious how the angle brackets appear in practice).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, a good idea. This is the trouble with using a test file and then forgetting to translate some things to the formal test cases.

And :ref:`Snapcraft <snapcraft>` is a named reference.
expect:
triggers: []
severity: error
Expand Down Expand Up @@ -723,13 +728,30 @@ rules:
- '50000'
- '65536'
severity: suggestion
- id: valid-comma-separated
filetypes: [md, rst]
- id: valid-comma-separated-rst
filetypes: [rst]
content: |
The file is 10,000 bytes.
Port 8080 is common.
Use 1234 as the identifier.
The value is 999 items.
The machine ID is ``12345``.
.. code::
Port 555555 is invalid.
expect:
triggers: []
severity: suggestion
- id: valid-comma-separated-md
filetypes: [md]
content: |
The file is 10,000 bytes.
Port 8080 is common.
Use 1234 as the identifier.
The value is 999 items.
The machine ID is `12345`.
```
Port 555555 is invalid.
```
expect:
triggers: []
severity: suggestion
Expand All @@ -744,12 +766,14 @@ rules:
$ sudo apt update
% make install
$ snap install lxd
$ ./run-me.sh
```
expect:
triggers:
- '$'
- '%'
- ' $'
- '$ sudo'
- '% make'
- ' $ snap'
- '$ ./run-me.sh'
severity: warning
- id: prompts-in-rst-code
filetypes: [rst]
Expand All @@ -760,18 +784,22 @@ rules:

$ snap install lxd
% make build
$ ./run-me.sh
expect:
triggers:
- ' $'
- ' %'
- ' $ snap'
- ' % make'
- ' $ ./run-me.sh'
severity: warning
- id: valid-no-prompts
filetypes: [md, rst]
content: |
Reading package lists...
Building dependency tree...
```
Reading package lists "${variable}"...
Building dependency 5 % 2 == 1
0 upgraded, 1 newly installed.
Setting up lxd (latest) ...
```
expect:
triggers: []
016-No-inline-comments:
Expand Down