diff --git a/.vale.ini b/.vale.ini index 97be9080f..45b2a451c 100644 --- a/.vale.ini +++ b/.vale.ini @@ -1,5 +1,8 @@ MinAlertLevel = warning -Packages = Google, https://github.com/errata-ai/Hugo/releases/download/v0.2.0/Hugo.zip, Readability, vale/Grafana + +Packages = vale/Grafana + +StylesPath = styles + [*.md] BasedOnStyles = Grafana -TokenIgnores = (+?), \*\*[^\n]+\*\* \ No newline at end of file diff --git a/vale/.vale-config/1-Hugo.ini b/vale/.vale-config/1-Hugo.ini deleted file mode 100644 index b0d6257de..000000000 --- a/vale/.vale-config/1-Hugo.ini +++ /dev/null @@ -1,10 +0,0 @@ -[*.md] -# Exclude `{{< ... >}}`, `{{% ... %}}`, [Who]({{< ... >}}) -TokenIgnores = ({{[%<] .* [%>]}}.*?{{[%<] ?/.* [%>]}}), \ -(\[.+\]\({{< .+ >}}\)), \ -({{[%<] .+ [%>]}}) - -# Exclude `{{< myshortcode `This is some HTML, ... >}}` -BlockIgnores = (?sm)^({{[%<] [^{]*? [%>]}})\n$, \ -(?s) *({{< highlight [^>]* ?>}}.*?{{< ?/ ?highlight >}}), \ -({{[%<] .+ [%>]}}) diff --git a/vale/.vale.ini b/vale/.vale.ini index 9f957f1b4..c5c98b29f 100644 --- a/vale/.vale.ini +++ b/vale/.vale.ini @@ -1,6 +1,5 @@ MinAlertLevel = suggestion -Packages = Grafana, https://github.com/errata-ai/Hugo/releases/download/v0.2.0/Hugo.zip +Packages = Grafana -[*] +[*.md] BasedOnStyles = Grafana -TokenIgnores = (+?), \*\*[^\n]+\*\* \ No newline at end of file diff --git a/vale/.vale.jsonnet b/vale/.vale.jsonnet deleted file mode 100644 index 11e0cb75f..000000000 --- a/vale/.vale.jsonnet +++ /dev/null @@ -1,26 +0,0 @@ -{ - configuration: { - main: { - StylesPath: '/etc/vale/styles', - MinAlertLevel: 'suggestion', - - Packages: 'Google, https://github.com/errata-ai/Hugo/releases/download/v0.2.0/Hugo.zip, Readability', - }, - sections: { - '*': { - BasedOnStyles: 'Grafana', - - // https://github.com/errata-ai/vale/issues/288 - TokenIgnores: @'(+?), \*\*[^\n]+\*\*', - }, - }, - }, - - container: std.manifestIni(self.configuration), - - repository: std.manifestIni(self.configuration { - main+: { - StylesPath: 'vale', - }, - }), -} diff --git a/vale/Grafana/.vale.ini b/vale/Grafana/.vale.ini new file mode 100644 index 000000000..2272da460 --- /dev/null +++ b/vale/Grafana/.vale.ini @@ -0,0 +1,6 @@ +StylesPath = styles + +Packages = https://github.com/errata-ai/Hugo/releases/download/v0.3.0/Hugo.zip + +[*.md] +TokenIgnores = (+?), \*\*[^\n]+\*\* \ No newline at end of file diff --git a/vale/Grafana/styles/Grafana/Admonitions.yml b/vale/Grafana/styles/Grafana/Admonitions.yml index e319582f8..a771aa877 100644 --- a/vale/Grafana/styles/Grafana/Admonitions.yml +++ b/vale/Grafana/styles/Grafana/Admonitions.yml @@ -11,6 +11,5 @@ script: | matches := [] for match in text.re_find(`(?i)> \*\*(?:note|warning|caution|tip):?\*\*`, scope, -1) { - matches = append(matches, {begin: match[0].begin, end: match[0].end}) - } + matches = append(matches, {begin: match[0].begin, end: match[0].end}) } diff --git a/vale/Grafana/styles/Grafana/AltText.yml b/vale/Grafana/styles/Grafana/AltText.yml index ce550567b..5f167111e 100644 --- a/vale/Grafana/styles/Grafana/AltText.yml +++ b/vale/Grafana/styles/Grafana/AltText.yml @@ -6,6 +6,5 @@ script: | text := import("text") matches := [] for match in text.re_find(`!\[\]\(.*?\)`, scope, -1) { - matches = append(matches, {begin: match[0].begin, end: match[0].end}) - } + matches = append(matches, {begin: match[0].begin, end: match[0].end}) } diff --git a/vale/Grafana/styles/Grafana/Gerunds.yml b/vale/Grafana/styles/Grafana/Gerunds.yml index 77d69ac88..34bce00ce 100644 --- a/vale/Grafana/styles/Grafana/Gerunds.yml +++ b/vale/Grafana/styles/Grafana/Gerunds.yml @@ -16,6 +16,5 @@ script: | matches := [] for match in text.re_find(`^ *[A-Z][a-zA-Z]*ing .*$`, scope, -1) { - matches = append(matches, {begin: match[0].begin, end: match[0].end}) - } + matches = append(matches, {begin: match[0].begin, end: match[0].end}) } diff --git a/vale/Grafana/styles/Grafana/Shortcodes.yml b/vale/Grafana/styles/Grafana/Shortcodes.yml index 43d483b28..24e2e4dc2 100644 --- a/vale/Grafana/styles/Grafana/Shortcodes.yml +++ b/vale/Grafana/styles/Grafana/Shortcodes.yml @@ -13,6 +13,5 @@ script: | matches := [] for match in text.re_find(`{{% +/?admonition .*%}}`, scope, -1) { - matches = append(matches, {begin: match[0].begin, end: match[0].end}) - } + matches = append(matches, {begin: match[0].begin, end: match[0].end}) } diff --git a/vale/Grafana/styles/Grafana/Spelling.yml b/vale/Grafana/styles/Grafana/Spelling.yml index 2ca3387d8..5c45f796c 100644 --- a/vale/Grafana/styles/Grafana/Spelling.yml +++ b/vale/Grafana/styles/Grafana/Spelling.yml @@ -14,7 +14,6 @@ message: | The spell checker doesn't check words with code formatting. level: error append: true -dicpath: config/dictionaries dictionaries: - en_US-grafana - en_US-places diff --git a/vale/Makefile b/vale/Makefile index 793ac549a..94c1bbc4d 100644 --- a/vale/Makefile +++ b/vale/Makefile @@ -62,11 +62,6 @@ sync: cd $(GIT_ROOT) && vale sync; cd - npx prettier -w . -.vale.ini ../.vale.ini: ## Generate Vale INI configuration from the Jsonnet data template. -.vale.ini ../.vale.ini: .vale.jsonnet - jsonnet -Se "(import '.vale.jsonnet').container" | sed '$${/^$$/d;}' > .vale.ini - jsonnet -Se "(import '.vale.jsonnet').repository" | sed '$${/^$$/d;}' > ../.vale.ini - .PHONY: Grafana/styles/Grafana/Google Grafana/styles/Grafana/Google: ## Generate the Grafana style from the Google style. Grafana/styles/Grafana/Google: google.jsonnet diff --git a/vale/README.md b/vale/README.md index 99297c6db..75e8f6449 100644 --- a/vale/README.md +++ b/vale/README.md @@ -1,12 +1,3 @@ # Vale -The [`.vale.ini`](.vale.ini) file in this directory is only for the container image. -For linting of this repository, the [`.vale.ini`](../.vale.ini) file in the root of the repository is used. -The two files should be mostly similar with the exception of the `Packages` and `StylesPath` configurations. -Perhaps in the future, these will be sourced from a single place. - -The Grafana style extends the Google style and disables some rules. -The Google style is vendored in the repository. -To update the Google style, run `make sync`. - To build the container image, run `make grafana/vale`.