rojopolis / spellcheck-github-actions

Spell check action
MIT License
132 stars 38 forks source link

Can't get it to work for German language #198

Closed cbirkenbeul closed 7 months ago

cbirkenbeul commented 7 months ago

Hi, I guess I have some issues in my .spellcheck.yml file, because it's not really checking German language. Otherwise it would have way too many false positives. Would this be a proper part of the config file?

matrix:
- name: Markdown
  expect_match: false
  apsell:
    mode: de_DE
  dictionary:
    wordlists:
    - .wordlist.txt
    output: wordlist.dic
    encoding: utf-8
  pipeline:
  - pyspelling.filters.markdown:
      markdown_extensions:
      - markdown.extensions.extra:
  - pyspelling.filters.html:
      comments: false
      attributes:
      - alt
      ignores:
      - ':matches(code, pre)'
      - 'code'
      - 'pre'
      - 'blockquote'
  sources:
  - '*.md'
  - 'content/posts/**/*.md'

Or should it be different? Maybe you could have an example config for a foreign language in your example folder for other people. :) Thanks.

jonasbn commented 7 months ago

Hi @cbirkenbeul

Is this lifted from your actual configuration? I can see that you have a spelling error. ‘apsell‘ should read: ‘aspell‘.

If your repository is public please provide a link, then I will have a look.

cbirkenbeul commented 7 months ago

Thanks for your fast help. Yes that is my actual config and my repo for that is not public, its on a self hosted git server.

I've fixed the typo. Thanks for that. Unfortunately its still not working, but now with a different error message:

Using pyspelling on configuration outlined in >.spellcheck.yml<
Checking files matching specified outlined in >.spellcheck.yml<
----------------------------------------------------------------
Using aspell to spellcheck Markdown
Running Task: Markdown...
Compiling Dictionary...
> Processing: content/posts/synology-cloud-backup-anbieter-im-vergleich/index.md
ERROR: content/posts/synology-cloud-backup-anbieter-im-vergleich/index.md: html>body>p -- Runtime Error: Error: Unknown mode: "de".

I change my config to this one:

matrix:
- name: Markdown
  expect_match: false
  aspell:
    mode: de
  dictionary:
    wordlists:
    - .wordlist.txt
    output: wordlist.dic
    encoding: utf-8
  pipeline:
  - pyspelling.filters.markdown:
      markdown_extensions:
      - markdown.extensions.extra:
  - pyspelling.filters.html:
      comments: false
      attributes:
      - alt
      ignores:
      - ':matches(code, pre)'
      - 'code'
      - 'pre'
      - 'blockquote'
  sources:
  - '*.md'
  - 'content/posts/**/*.md'

Just in case, thats my build pipeline

name: Website

on:
  workflow_dispatch:
  push:
    branches:
      - main

jobs:
  deploy:
    name: Build and Deploy
    runs-on: ubuntu-latest
    steps:
      - name: 🛒 Checkout
        uses: actions/checkout@v3
      - name: Check Spelling
        uses: rojopolis/spellcheck-github-actions@0.36.0
        with:
          config_path: .spellcheck.yml
          task_name: Markdown
jonasbn commented 7 months ago

Hi @cbirkenbeul

Ok, one more correction to your configuration file.

aspell takes a lang parameter not: mode

Please see: https://github.com/rojopolis/spellcheck-github-actions?tab=readme-ov-file#specifying-language

Does any of the examples in the documentation or else in the repository use mode, because then I need to correct that error.

jonasbn commented 7 months ago

Hi @cbirkenbeul

Did you get this to work?

Else I will dig more into your configuration file.

cbirkenbeul commented 7 months ago

Hi. Yes its working now. Thanks for your help.

Its just quite annoying that all english words now marked as false. I have to figure out if its possible to use multiple languages in a single check. If you like, we can close this issue.

jonasbn commented 7 months ago

Thanks @cbirkenbeul

I am not sure how to mix two languages/dictionaries. I will do some research.