errata-ai / packages

:package: A collection of pre-packaged, Vale-compatible style guides and configurations.
MIT License
97 stars 18 forks source link

Red Hat package #11

Open apupier opened 1 year ago

apupier commented 1 year ago

Red Hat is providing a Vale configuration of their style guide. it would be nice to provide a package for it.

the zip currently attached to the tag is matching the requirements.https://github.com/redhat-documentation/vale-at-red-hat/releases/tag/v143 contains a folder and then the .vale.ini file. I guess it can be used as-is. To be checked.

apupier commented 1 year ago

When trying to use the existing zip file I have this error:

(base) [apupier@localhost test-asciidoc]$ vale sync
Downloading packages [0/1] █                                                                                                                                0% | 0slstat 
/tmp/v1431725917740/v143: no such file or directory

using a .vale.ini which look salike:

StylesPath = .vale/styles

Packages = https://github.com/redhat-documentation/vale-at-red-hat/archive/refs/tags/v143.zip
apupier commented 1 year ago

found the issuefo rth eno such file or directory: the name of the zip must match the top folder content.

it is working when using https://github.com/apupier/vale-at-red-hat/releases/tag/v143 where I used https://github.com/apupier/vale-at-red-hat/releases/download/v143/vale-at-red-hat-143.zip

th ezip file is the same than on official repo named v143.

The top-level older nside the archive is named vale-at-red-hat-143

apupier commented 1 year ago

now, there is this error when running vale .:

E100 [loadStyles] Runtime error

style 'RedHat' does not exist on StylesPath

Execution stopped with code 1.
apupier commented 1 year ago

With .vale.ini:

StylesPath = .vale/styles

Packages = https://github.com/apupier/vale-at-red-hat/releases/download/v143/vale-at-red-hat-143.zip

vale sync returns success

base) [apupier@localhost test-asciidoc]$ vale sync
 SUCCESS  Downloaded package 'vale-at-red-hat-143'                                                                                                                 
Downloading packages [1/1] ██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 100% | 2s

but vale . returns error:


style 'RedHat' does not exist on StylesPath

Execution stopped with code 1.

vale ls-config shows that several Red Hat thingy were applied:

{
  "BlockIgnores": {
    "*.md": [
      "(?sm)^({{[%\u003c] [^{]*? [%\u003e]}})\\n$",
      "(?s) *({{\u003c highlight [^\u003e]* ?\u003e}}.*?{{\u003c ?/ ?highlight \u003e}})"
    ]
  },
  "Checks": [
    "RedHat.CaseSensitiveTerms",
    "RedHat.ConfigMap",
    "RedHat.Definitions",
    "RedHat.Slash",
    "RedHat.Spacing",
    "RedHat.Spelling",
    "RedHat.TermsSuggestions"
  ],
  "Formats": {
    "properties": "md"
  },
  "Asciidoctor": {},
  "FormatToLang": {},
  "GBaseStyles": null,
  "GChecks": {},
  "IgnoredClasses": null,
  "IgnoredScopes": [
    "code",
    "tt",
    "img",
    "url",
    "a",
    "body.id"
  ],
  "MinAlertLevel": 0,
  "Vocab": null,
  "RuleToLevel": {},
  "SBaseStyles": {
    "*.ini": [
      "RedHat"
    ],
    "*.md": [
      "RedHat"
    ],
    "*.rst": [
      "RedHat"
    ],
    "[!.]*.adoc": [
      "RedHat"
    ]
  },
  "SChecks": {
    "*.ini": {
      "RedHat.CaseSensitiveTerms": false,
      "RedHat.ConfigMap": false,
      "RedHat.Definitions": false,
      "RedHat.Slash": false,
      "RedHat.Spacing": false,
      "RedHat.Spelling": false,
      "RedHat.TermsSuggestions": false
    },
    "*.md": {},
    "*.rst": {},
    "[!.]*.adoc": {}
  },
  "SkippedScopes": [
    "script",
    "style",
    "pre",
    "figure",
    "code",
    "tt",
    "blockquote",
    "listingblock",
    "literalblock"
  ],
  "Stylesheets": {},
  "StylesPath": "/home/apupier/ws/test-asciidoc/.vale/styles",
  "TokenIgnores": {
    "*.ini": [
      "(\\x60[^\\n\\x60]+\\x60)",
      "([^\\n]+=[^\\n]*)",
      "(\\+[^\\n]+\\+)",
      "(http[^\\n]+\\[)"
    ],
    "*.md": [
      "({{[%\u003c] .* [%\u003e]}}.*?{{[%\u003c] ?/.* [%\u003e]}})",
      "(\\[.+\\]\\({{\u003c .+ \u003e}}\\))",
      "(\\x60[^\\n\\x60]+\\x60)",
      "([^\\n]+=[^\\n]*)",
      "(\\+[^\\n]+\\+)",
      "(http[^\\n]+\\[)"
    ],
    "[!.]*.adoc": [
      "(:[^\\n]+: [^\\n]+)",
      "(\\[id=[^\\n]+)"
    ]
  },
  "WordTemplate": "",
  "DictionaryPath": "",
  "NLPEndpoint": ""
}

Inside .vale\styles, I do not have a RedHat folder, it loosk alike the resources mentioned by the .vale.ini of the Red Hat zip were not copied.

i tried to apply th epackage fromMicrosoft and the styles are copied in .vale\Styles but Microsoft does not use a .vale.ini.

@jdkato Can it be that the sync command doesn't support a .vale.ini which is referencing a styles folder?

apupier commented 1 year ago

If i separate the .vale.ini and the styles files in 2 different zip, the RedHat folder in styles is created.

StylesPath = .vale/styles

Packages = https://github.com/apupier/vale-at-red-hat/releases/download/v143/handcrafted-vale-at-redhat-143.zip, https://github.com/apupier/vale-at-red-hat/releases/download/v143/handcrafted-just-styles-vale-at-redhat-143.zip

But now when trying to run vale, I have this error:

$ vale .
E100 [lintAdoc] Runtime error

asciidoctor not found

Execution stopped with code 1.

EDIT: asciidoctor must be installed on system path

apupier commented 1 year ago

tried again to use a complete zip, with both styles and .vale.ini, Using:

StylesPath = .vale/styles

Packages = https://github.com/apupier/vale-at-red-hat/releases/download/v143/handcrafted-complete-vale-at-redhat-143.zip

I have this error:

(base) [apupier@localhost test-asciidoc]$ vale sync
 SUCCESS  Downloaded package 'handcrafted-complete-vale-at-redhat-143'                                                                                          
Downloading packages [1/1] ███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 100% | 1s
(base) [apupier@localhost test-asciidoc]$ vale .
E201 Invalid value [/home/apupier/ws/test-asciidoc/.vale.ini:1:20]:

   1* StylesPath = .vale/styles
   2  
   3  Packages = https://github.com/apupier/vale-at-red-hat/releases/download/v143/handcrafted-complete-vale-at-redhat-143.zip

The path '/home/apupier/ws/test-asciidoc/styles' does not exist.

Execution stopped with code 1.

it seems that the StylesPath which is in .vale/styles/.vale-config/0-handcrafted-complete-vale-at-redhat-143.ini is used and not placed from the correct folder

jdkato commented 1 year ago

As stated in the documentation,

You cannot use arbitrary directory structures such as the nested .vale/styles.

apupier commented 1 year ago

As stated in the documentation,

* The `StylesPath` should be a top-level directory named `styles`.

* The `.vale.ini` file needs to reference this value, e.g., `StylesPath = styles`.

You cannot use arbitrary directory structures such as the nested .vale/styles.

I use the different value for the .vale.ini that I have locally, the one referencing the zip file. Inside the zip file, there si the top-level directory style and the .vale.ini is mentioning StylesPath = styles.