PyCQA / PyCQA/flake8

local-plugins relative paths are resolved relative to all paths not just the one the path directive is found

Open
#759 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.8k
Forks
356
PR merge metrics
No merged PRs in 30d

Description

In GitLab by @graingert on Jul 13, 2020, 08:57

Please describe how you installed Flake8

pre-commit of course

Please provide the exact, unmodified output of flake8 --bug-report

{
  "dependencies": [],
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.8.2",
    "system": "Linux"
  },
  "plugins": [
    {
      "is_local": false,
      "plugin": "flake8-tidy-imports",
      "version": "4.1.0"
    },
    {
      "is_local": false,
      "plugin": "flake8_coding",
      "version": "1.3.2"
    },
    {
      "is_local": false,
      "plugin": "mccabe",
      "version": "0.6.1"
    },
    {
      "is_local": false,
      "plugin": "pycodestyle",
      "version": "2.6.0"
    },
    {
      "is_local": false,
      "plugin": "pyflakes",
      "version": "2.2.0"
    }
  ],
  "version": "3.8.3"
}

Please describe the problem or feature

the paths are resolved relative to all paths not just the one the path directive is found in eg:

.
└── foo
    ├── bar
    │   ├── baz
    │   └── .flake8
    ├── baz
    └── .flake8
[flake8:local-plugins]
...
paths = ./baz

when running flake8 --append-config=foo/bar/.flake8 --append-config=foo/.flake8 flake8 will add foo/baz and foo/bar/baz to LocalPlugins.paths

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the shown directory tree and the two --append-config arguments, then trace local-plugin paths configuration handling. Done means ./baz is resolved only relative to the configuration file containing the path directive, rather than being added relative to every loaded configuration path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.