Skip to content
15 changes: 15 additions & 0 deletions styles/Canonical/019-no-external-images.yml
Comment thread
sefeijoo marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 19 - No external images

extends: existence
message: "Don't use images from Google Drive or the asset manager. Store images in the repository."
scope: raw
nonword: true
level: error
tokens:
- '!\[[^\n]*\]\([\w\.:\/\-=\? \"]+(drive.google|drive.usercontent.google|assets.ubuntu)[\w\.:\/\-=\? \"]+\)'
- '<[\w\.:\/-=? "]+(drive.google|drive.usercontent.google|assets.ubuntu)[\w\.:\/\-=? "]+>'
- '{image}[\w\.:\/\-=? "]+(drive.google|drive.usercontent.google|assets.ubuntu)[\w\.:\/\-=? "]+'
- '{figure}[\w\.:\/\-=? "]+(drive.google|drive.usercontent.google|assets.ubuntu)[\w\.:\/\-=? "]+'
- '\.\. image::[\w\.:\/\-=? "]+(drive.google|drive.usercontent.google|assets.ubuntu)[\w\.:\/\-=? "]+'
- '\.\. figure::[\w\.:\/\-=? "]+(drive.google|drive.usercontent.google|assets.ubuntu)[\w\.:\/\-=? "]+'

15 changes: 0 additions & 15 deletions styles/Canonical/019-no-google-drive-images.yml

This file was deleted.

96 changes: 88 additions & 8 deletions tests/data/manifest.yml
Comment thread
sefeijoo marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -416,14 +416,94 @@ rules:
let value = 10; // Initialize value
severity: suggestion
# For 017, see the end of this file, as the content is long.
# 019-no-google-drive-images:
# cases:
# - id: valid
# filetypes: [md, rst]
# content:
# expect:
# triggers:
# severity:
019-no-external-images:
cases:
- id: google-drive-md
filetypes: [md]
content: "![alt](https://drive.google.com/file/d/abc123)"
expect:
triggers:
- "![alt](https://drive.google.com/file/d/abc123)"
severity: error
- id: google-drive-rst-image
filetypes: [rst]
content: ".. image:: https://drive.google.com/file/d/abc123"
expect:
triggers:
- ".. image:: https://drive.google.com/file/d/abc123"
severity: error
- id: google-drive-rst-figure
filetypes: [rst]
content: ".. figure:: https://drive.google.com/file/d/abc123"
expect:
triggers:
- ".. figure:: https://drive.google.com/file/d/abc123"
severity: error
- id: asset-manager-md
filetypes: [md]
content: "![alt](https://assets.ubuntu.com/v1/abc123)"
expect:
triggers:
- "![alt](https://assets.ubuntu.com/v1/abc123)"
severity: error
- id: asset-manager-rst-image
filetypes: [rst]
content: ".. image:: https://assets.ubuntu.com/v1/abc123"
expect:
triggers:
- ".. image:: https://assets.ubuntu.com/v1/abc123"
severity: error
- id: asset-manager-rst-figure
filetypes: [rst]
content: ".. figure:: https://assets.ubuntu.com/v1/abc123"
expect:
triggers:
- ".. figure:: https://assets.ubuntu.com/v1/abc123"
severity: error
- id: asset-manager-myst-backtick-image
filetypes: [md]
content: "```{image} https://assets.ubuntu.com/v1/abc123"
expect:
triggers:
- "{image} https://assets.ubuntu.com/v1/abc123"
severity: error
- id: asset-manager-myst-colon-image
filetypes: [md]
content: ":::{image} https://assets.ubuntu.com/v1/abc123"
expect:
triggers:
- "{image} https://assets.ubuntu.com/v1/abc123"
severity: error
- id: asset-manager-myst-backtick-figure
filetypes: [md]
content: "```{figure} https://assets.ubuntu.com/v1/abc123"
expect:
triggers:
- "{figure} https://assets.ubuntu.com/v1/abc123"
severity: error
- id: asset-manager-myst-colon-figure
filetypes: [md]
content: ":::{figure} https://assets.ubuntu.com/v1/abc123"
expect:
triggers:
- "{figure} https://assets.ubuntu.com/v1/abc123"
severity: error
- id: local-image-md
filetypes: [md]
content: "![alt](images/local-image.png)"
expect:
triggers: []
- id: local-image-rst
filetypes: [rst]
content: ".. image:: images/local-image.png"
expect:
triggers: []
- id: local-image-myst
filetypes: [md]
content: "```{image} images/local-image.png"
expect:
triggers: []

025a-latinisms-with-english-equivalents:
cases:
- id: latin-terms-with-substitutions
Expand Down
2 changes: 1 addition & 1 deletion vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Canonical.015-No-prompts-in-comments = warning
Canonical.016-No-inline-comments = suggestion
Canonical.017a-Suggest-code-over-25-lines = suggestion
Canonical.017b-Warn-code-over-35-lines = warning
Canonical.019-no-google-drive-images = error
Canonical.019-no-external-images = error
Canonical.025a-latinisms-with-english-equivalents = suggestion
Canonical.025b-latinisms-to-reconsider = suggestion
Canonical.025c-latinisms-to-avoid = suggestion
Expand Down