pylint icon indicating copy to clipboard operation
pylint copied to clipboard

The similar checker will append the same stream in some weird reason

Open Graywd opened this issue 5 years ago • 0 comments

Steps to reproduce

In my project, I have a module named sql_control and add the Pylint to check it. Everything is ok when I execute the command below:

poetry run pylint --load-plugins pylint_flask_sqlalchemy,pylint_flask sql_control

However, things get weird when I try to use the Pylint by the pre-commit hook.

poetry run pre-commit

Here is my pre-commit-config:

-   repo: local
    hooks:
    -   id: pylint
        name: pylint
        entry: poetry run pylint --load-plugins pylint_flask_sqlalchemy,pylint_flask sql_control
        language: system
        types: [python]

Then I get a message about duplicate-code:

image

The checker tries to check the same file rather than differ. After reading some code, I find the face reason is that append the same stream, so add a print to check.

image

I have no idea about the reason why the same stream would be appended but maybe we could add a simple check at this code snip or somewhere else.

image

pylint --version output

pylint 2.6.0 astroid 2.4.2 Python 3.8.2 (default, Sep 2 2020, 19:07:38) [Clang 11.0.3 (clang-1103.0.32.62)]

Graywd avatar Sep 18 '20 08:09 Graywd