Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Pipline step in unexpected format: {'pyspelling.filters.html': None, 'comments': False, 'ignores': ['code', 'pre']} #60

Closed
Sid-ah opened this issue Aug 16, 2021 · 4 comments

Comments

@Sid-ah
Copy link

Sid-ah commented Aug 16, 2021

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.

@facelessuser
Copy link

@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

@Sid-ah
Copy link
Author

Sid-ah commented Aug 17, 2021

Thank you @facelessuser! Fixing the indentation did the trick for me.

@Sid-ah Sid-ah closed this as completed Aug 17, 2021
@facelessuser
Copy link

No problem, glad I could help 🙂 .

jonasbn added a commit that referenced this issue Aug 18, 2021
jonasbn added a commit that referenced this issue Aug 18, 2021
* Corrected example, see also issue #60

* Updated diagnostics section with desciption of issue #60
@jonasbn
Copy link
Collaborator

jonasbn commented Aug 18, 2021

Thanks @Sid-ah and @facelessuser

I have updated the documentation describing the remedy to avoid this issue, based on your input to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants