带有python 3.5中的预提交的Pylint设置

问题描述 投票:0回答:1

我试图在我的项目中将pylint设置为pre-commit。我来到this回答他们告诉我如何设置.pre-commit-config.yaml的问题。当我转到答案中提到的repository时,他们写道:>

不建议使用此镜像存储库,请直接使用pylint

所以我这样设置了.pre-commit-config.yaml文件

-   repo: https://github.com/pycqa/pylint
    rev: pylint-2.4.4
    hooks:
    -   id: pylint
        args:
        - --limit=8
        - --rcfile=$PROJECT_ROOT/.pylintrc

但是现在当我尝试做时

$ pre-commit run

它出现以下错误:

An unexpected error has occurred: CalledProcessError: command: ('/Users/userabc/.cache/pre-commit/repokxyo7uuq/py_env-default/bin/python', '/Users/userabc/.cache/pre-commit/repokxyo7uuq/py_env-default/bin/pip', 'install', '.')
return code: 1
expected return code: 0
stdout:
    Processing /Users/userabc/.cache/pre-commit/repokxyo7uuq

stderr:
        ERROR: Command errored out with exit status 1:
         command: /Users/userabc/.cache/pre-commit/repokxyo7uuq/py_env-default/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/gm/t0h6v8jx4bqd6cj73_k27myw0000gp/T/pip-req-build-5vjdd9f2/setup.py'"'"'; __file__='"'"'/private/var/folders/gm/t0h6v8jx4bqd6cj73_k27myw0000gp/T/pip-req-build-5vjdd9f2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/gm/t0h6v8jx4bqd6cj73_k27myw0000gp/T/pip-req-build-5vjdd9f2/pip-egg-info
             cwd: /private/var/folders/gm/t0h6v8jx4bqd6cj73_k27myw0000gp/T/pip-req-build-5vjdd9f2/
        Complete output (7 lines):
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/private/var/folders/gm/t0h6v8jx4bqd6cj73_k27myw0000gp/T/pip-req-build-5vjdd9f2/setup.py", line 60, in <module>
            long_description = stream.read()
          File "/Users/userabc/.pyenv/versions/3.5.2/lib/python3.5/encodings/ascii.py", line 26, in decode
            return codecs.ascii_decode(input, self.errors)[0]
        UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 4020: ordinal not in range(128)
        ----------------------------------------
    ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Check the log at /Users/userabc/.cache/pre-commit/pre-commit.log

我的项目和虚拟环境的python版本是3.5.2。这是pylint还是pre-commit中的错误?还是我做错了?

我试图在我的项目中设置带有预提交的pylint。我来到这个答案,他们告诉我如何设置我的.pre-commit-config.yaml。当我进入答案中提到的存储库时,它们...

python python-3.x python-3.5 pylint pre-commit.com
1个回答
0
投票

似乎您正在环境中设置了错误/错误的语言环境。

© www.soinside.com 2019 - 2024. All rights reserved.