Skip to content

Bug located in the numpydoc-validation pre-commit hook #505

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

Closed
clatapie opened this issue Sep 27, 2023 · 1 comment
Closed

Bug located in the numpydoc-validation pre-commit hook #505

clatapie opened this issue Sep 27, 2023 · 1 comment

Comments

@clatapie
Copy link

When running the numpydoc-validation pre-commit hook in a project, an error is raised.

The numpydoc-validation pre-commit hook has been added in a pre-commit-config.yaml file as follow:

- repo: https://github.com/numpy/numpydoc
  rev: v1.6.0
  hooks:
    - id: numpydoc-validation

However, the following error is raised when running the pre-commit command:

numpydoc-validation......................................................Failed
- hook id: numpydoc-validation
- exit code: 1

Traceback (most recent call last):
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\.cache\pre-commit\repod38puuk8\py_env-python3.10\Scripts\validate-docstrings.EXE\__main__.py", line 7, in <module>
  File "C:\Users\.cache\pre-commit\repod38puuk8\py_env-python3.10\lib\site-packages\numpydoc\hooks\validate_docstrings.py", line 400, in main
    findings.extend(process_file(file, config_options))
  File "C:\Users\.cache\pre-commit\repod38puuk8\py_env-python3.10\lib\site-packages\numpydoc\hooks\validate_docstrings.py", line 339, in process_file    
    docstring_visitor.visit(module_node)
  File "C:\Users\.cache\pre-commit\repod38puuk8\py_env-python3.10\lib\site-packages\numpydoc\hooks\validate_docstrings.py", line 219, in visit
    self._get_numpydoc_issues(node)
  File "C:\Users\.cache\pre-commit\repod38puuk8\py_env-python3.10\lib\site-packages\numpydoc\hooks\validate_docstrings.py", line 188, in _get_numpydoc_issues
    report = validate.validate(
  File "C:\Users\.cache\pre-commit\repod38puuk8\py_env-python3.10\lib\site-packages\numpydoc\validate.py", line 617, in validate
    ignore_validation_comments = extract_ignore_validation_comments(
  File "C:\Users\.cache\pre-commit\repod38puuk8\py_env-python3.10\lib\site-packages\numpydoc\validate.py", line 145, in extract_ignore_validation_comments
    for token in tokenize.generate_tokens(file.readline):
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\tokenize.py", line 452, in _tokenize
    line = readline()
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 3194: character maps to <undefined>

Additional information

OS: Windows
Python version: 3.10.8

Local resolution of the bug

It seems to be an issue related to an encoding issue.

@rossbar
Copy link
Contributor

rossbar commented Oct 10, 2023

This was closed by #510 - thanks for reporting @clatapie !

@rossbar rossbar closed this as completed Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants