Skip to content

Disable pylintUseMinimalCheckers when local pylint config exists #788

Closed

Description

I understand that it makes sense to hide some errors by default but if a project explicitly configures the linter then I think the editor should not override local choices. I am specifically talking about cases where one of the following is true:

  • .pylintrc exists
  • pylintrc exists
  • PYLINTRC environment variable is set and points to an existing file
  • pylintArgs setting is customized

Activity

  1. added
    bug
    on Feb 15, 2018
  2. MikhailArkhipov commented on Feb 15, 2018

    @MikhailArkhipov

    It should become disabled. See https://github.com/Microsoft/vscode-python/blob/master/src/client/linters/pylint.ts, hasConfigurationFile. Logic copied from pylint itself. Can you provide repro when it doesn't?

  3. added
    info-needed
    on Feb 15, 2018
  4. parkerd commented on Feb 15, 2018

    @parkerd

    There's a faulty assumption at https://github.com/Microsoft/vscode-python/blob/master/src/client/linters/pylint.ts#L82-L84 that the directory should have __init__.py, which generally won't be true if .pylintrc is at the root of a repo.

    For reference, this is the relevant logic in pylint: https://github.com/PyCQA/pylint/blob/master/pylint/config.py#L106-L113 . It will look .. one directory from the last __init__.py, instead of leaving the loop when there is none.

  5. MikhailArkhipov commented on Feb 16, 2018

    @MikhailArkhipov

    Makes sense. Thank you.

  6. MikhailArkhipov commented on Feb 16, 2018

    @MikhailArkhipov

    The assumption was based on

    def find_pylintrc():
    ...
            curdir = os.path.abspath(os.getcwd())
            while os.path.isfile(os.path.join(curdir, '__init__.py')):
                curdir = os.path.abspath(os.path.join(curdir, '..'))
                if os.path.isfile(os.path.join(curdir, 'pylintrc')):
                    return os.path.join(curdir, 'pylintrc')
                if os.path.isfile(os.path.join(curdir, '.pylintrc')):
                    return os.path.join(curdir, '.pylintrc')
    

    which appears to only walk up the tree if __init.py__ is present...

    https://pylint.readthedocs.io/en/latest/user_guide/run.html#command-line-options

    You can specify a configuration file on the command line using the --rcfile option. Otherwise, Pylint searches for a configuration file in the following order and uses the first one it finds:

    1. pylintrc in the current working directory
    2. .pylintrc in the current working directory
    3. If the current working directory is in a Python module, Pylint searches up the hierarchy of Python modules until it finds a pylintrc file. This allows you to specify coding standards on a module-by-module basis. Of course, a directory is judged to be a Python module if it contains an __init__.py file.
    4. The file named by environment variable PYLINTRC
    5. if you have a home directory which isn’t /root:
      a.pylintrc in your home directory
      b. config/pylintrc in your home directory
    6. /etc/pylintrc
  7. MikhailArkhipov commented on Feb 16, 2018

    @MikhailArkhipov

    Actual problem is that check for the config file happens before run and then run changes current working directory to the workspace root.

  8. locked as resolved and limited conversation to collaborators on Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-lintingbuginfo-needed

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions