errata-ai / vale-action

:octocat: The official GitHub Action for Vale -- install, manage, and run Vale with ease.
MIT License
201 stars 51 forks source link

Vale configuration in GitHub Actions for asciidoctor files #11

Closed hepabolu closed 4 years ago

hepabolu commented 4 years ago

I am trying to get the Vale GitHub Action working for my book that consists of multiple Asciidoctor files.

So far I have the action working, but I am not sure the official action includes asciidoctor, because it throws error messages on lines in source code blocks.

I would also like for it to use an en_GB dictionary.

These are the configuration files I've used. .vale.ini

StylesPath = .github/styles
MinAlertLevel = suggestion

[./*.md]
BasedOnStyles = Vale

[book/*.adoc]
BasedOnStyles = Vale

.github/vale-linter.yml

name: Linting
on: [push]

jobs:
  prose:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@master

      - name: Vale
        uses: errata-ai/vale-action@v1.0.4
        with:
          styles: |
            Vale
            https://github.com/errata-ai/write-good/releases/latest/download/write-good.zip
            https://github.com/errata-ai/proselint/releases/latest/download/proselint.zip
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

How can I tell it to ignore the source code blocks and use an en_GB dictionary?

jdkato commented 4 years ago
  1. The action does include asciidoctor. Is your project public or could you share an example of a mishandled file?
  2. To use an en_GB dictionary, you'll need to create your own Spelling rule and provide the .dic and .aff files.
hepabolu commented 4 years ago

I'm sorry, right now I can't make the project public.

Re 1. I'm still looking for the example I truly had, but in the meantime I found this:

 kbd:[{commandkey} + Q]

Vale complains about 'commandkey' as well as about other variable names.

Re 2. I have this in .github/styles/Spelling/Ignores.yml

extends: spelling
aff: /usr/share/hunspell/en_GB.aff
dic: /usr/share/hunspell/en_GB.dic
message: "Did you really mean '%s'?"
level: error
ignore: ../vocab.txt

Is this correct?

ChrisChinchilla commented 4 years ago

@hepabolu Hard to say exactly without seeing an example, but my general experience of word exception lists was that the path had to be relative to the .yml file, I could never get files elsewhere to recognised. I am not sure if that is still correct, a bug, or working as intended.

hepabolu commented 4 years ago

@ChrisChinchilla Sorry for not responding earlier. Re the path: it's relative as you can see in my example. I can also add a word which is ignored from there on. So the vocab.txt is found and used.

The example would be something like this (I can't find the actual issue):

[source,shell]
====
mkdir /tmp/test
====

where Vale would report about mkdir.

hepabolu commented 4 years ago

I finally found my actual problem:

[source,console?prompt=me$,linenums,highlight='1']
----
grumpy:~ me$ curl -v http://some.domain.com/
...
----

Vale considers 'http' an error, when in fact it should skip everything from [source until the last ----

ChrisChinchilla commented 4 years ago

OK @hepabolu do you need any more help here?

hepabolu commented 4 years ago

I consider this a bug. I would like to know your opinion.

jdkato commented 4 years ago

I can't say for sure without seeing the entire file, but this is almost certainly a case of https://github.com/errata-ai/vale/issues/95.

You can verify this by testing a simpler file:

$ cat code.adoc
= Test

[source,console?prompt=me$,linenums,highlight='1']
----
grumpy:~ me$ curl -v http://some.domain.com/
...
----
$ cat .vale.ini
StylesPath = styles
MinAlertLevel = suggestion

[*]
BasedOnStyles = Vale
$ vale code.adoc
✔ 0 errors, 0 warnings and 0 suggestions in 1 file.