ValueError: Pipline step in unexpected format: {'pyspelling.filters.html': None, 'comments': False, 'ignores': ['code', 'pre']}
Sid-ah opened this issue · 4 comments
I tried to follow the example below, but I'm getting some errors.
matrix:
- name: Markdown
aspell:
lang: en
dictionary:
wordlists:
- .wordlist.txt
encoding: utf-8
pipeline:
- pyspelling.filters.markdown:
- pyspelling.filters.html:
comments: false
ignores:
- code
- pre
sources:
- '**/*.md'
default_encoding: utf-8
Here is the error I'm getting:
Traceback (most recent call last):
File "/usr/local/bin/pyspelling", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/pyspelling/__main__.py", line 30, in main
return run(
File "/usr/local/lib/python3.9/site-packages/pyspelling/__main__.py", line 55, in run
for results in spellcheck(
File "/usr/local/lib/python3.9/site-packages/pyspelling/__init__.py", line 673, in spellcheck
for result in spellchecker.run_task(task, source_patterns=sources):
File "/usr/local/lib/python3.9/site-packages/pyspelling/__init__.py", line 311, in run_task
self._build_pipeline(task)
File "/usr/local/lib/python3.9/site-packages/pyspelling/__init__.py", line 255, in _build_pipeline
raise ValueError(STEP_ERROR.format(str(step)))
ValueError: Pipline step in unexpected format: {'pyspelling.filters.html': None, 'comments': False, 'ignores': ['code', 'pre']}
I was able to resolve it by removing the pipeline step. Is this a known issue? This is a recent issue as I have used this action for some time now.
@Sid-ah This is really an upstream PySpelling question. I imagine your issue is that you need to indent comments
and ignores
more.
The short of it is that YAML can be finicky about indentation in these cases. Options keys need to be nested under the filter name key, not at the same level as the filter name. It thinks you have a multi-key dictionary for your HTML filter. Not a dictionary of options nested dictionary under it specifying option names.
This is not what you want:
namekey:
optionkey: bad
This is what you want:
namekey:
optionkey: good
Users will think they are disabling comments in your example, but they are not actually, so we identify this scenario and throw an error so the user is aware.
Try this which nests the options as a separate dictionary under the filter key.
matrix:
- name: Markdown
aspell:
lang: en
dictionary:
wordlists:
- .wordlist.txt
encoding: utf-8
pipeline:
- pyspelling.filters.markdown:
- pyspelling.filters.html:
comments: false
ignores:
- code
- pre
sources:
- '**/*.md'
default_encoding: utf-8
Thank you @facelessuser! Fixing the indentation did the trick for me.
No problem, glad I could help 🙂 .
Thanks @Sid-ah and @facelessuser
I have updated the documentation describing the remedy to avoid this issue, based on your input to this issue.