rojopolis/spellcheck-github-actions

Update problem at 0.28.0 -> 0.29.0

Lasica opened this issue · 3 comments

Lasica commented

I've found that my spellcheck config works for version 0.28.0 and before, but at 0.29.0 I have the following crash:

Checking files matching specified outlined in >.spellcheck.yml<
----------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/bin/pyspelling", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyspelling/__main__.py", line 30, in main
    return run(
           ^^^^
  File "/usr/local/lib/python3.11/site-packages/pyspelling/__main__.py", line 55, in run
    for results in spellcheck(
  File "/usr/local/lib/python3.11/site-packages/pyspelling/__init__.py", line 673, in spellcheck
    for result in spellchecker.run_task(task, source_patterns=sources):
  File "/usr/local/lib/python3.11/site-packages/pyspelling/__init__.py", line 311, in run_task
    self._build_pipeline(task)
  File "/usr/local/lib/python3.11/site-packages/pyspelling/__init__.py", line 265, in _build_pipeline
    self.pipeline_steps.append(module(options, **kwargs))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyspelling/filters/context.py", line 17, in __init__
    super().__init__(options, default_encoding)
  File "/usr/local/lib/python3.11/site-packages/pyspelling/filters/__init__.py", line 86, in __init__
    super().__init__(options)
  File "/usr/local/lib/python3.11/site-packages/pyspelling/plugin.py", line 23, in __init__
    self.setup()
  File "/usr/local/lib/python3.11/site-packages/pyspelling/filters/context.py", line 72, in setup
    self.delimiters.append((re.compile(pattern, re.M), group))
                            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/re/__init__.py", line 227, in compile
    return _compile(pattern, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/re/__init__.py", line 294, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/re/_compiler.py", line 743, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/re/_parser.py", line 980, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/re/_parser.py", line 455, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/re/_parser.py", line 841, in _parse
    raise source.error('global flags not at the start '
re.error: global flags not at the start of the expression at position 1
::error title=Spelling errors::Files in repository contain spelling errors

and it occurs in all higher versions. Here's my spellcheck.yml:

spellchecker: aspell
matrix:
  - name: Check the english docs
    aspell:
      ignore-case: ""
      lang: en
    sources:
      - "docs/**/*.md"
      - "CONTRIBUTING.md"
      - "README.md"
    default_encoding: utf-8
    pipeline:
    - pyspelling.filters.context:
        context_visible_first: true
        escapes: \\[\\`~]
        delimiters:
          # Ignore multiline content between fences (fences can have 3 or more back ticks)
          # ```
          # content
          # ```
          - open: '^(?s)(?P<open>`{1,3})[^`]'
            close: '(?P=open)'
          # Ignore text between inline back ticks
          - open: '(?P<open>`)[^`]'
            close: '(?P=open)'
          # Ignore text in brackets [] and ()
          - open: '\['
            close: '\]'
          - open: '\('
            close: '\)'
          - open: '\{'
            close: '\}'
    - pyspelling.filters.markdown:
        markdown_extensions:
        - pymdownx.superfences
    dictionary:
      wordlists:
        - docs/spellcheck_exceptions.txt

Any ideas what could be the issue? I've checked changelog to see what's changed in those versions but apart from python/library updates I didn't see anything. There was also addition of markdown check to default spelling.yml

Lasica commented
Lasica commented

So we can close it, leave it archived so maybe someone else encounters this issue.

the (?s) in regex was the cause.

Created a new diagnostic section in the documentation based on this, ref: #190