Skip to content

FileNotFoundError: Plug-in Flake8-pyproject could not find custom configuration file #1022

Closed
@Smit-Parmar

Description

@Smit-Parmar

Current Situation

Getting FileNotFoundError while running hatch run lint-py command.

Error only where there is not linting needed.
Throwing error on command below
flake8 --toml-config /home/dir1 name with space/reactpy/pyproject.toml .
Works fine when running
flake8 --toml-config pyproject.toml .

Step to reproduce:

  1. Create a folder which consist of white space
  2. Clone repo inside that folder
  3. Run hatch run lint-py

System detail

  • Ubuntu
  • Python 3.9

Proposed Actions

def lint_py(context: Context, fix: bool = False):
    """Run linters and type checkers"""
    if fix:
        context.run("ruff --fix .")
    else:
        context.run("ruff .")
        context.run("black --check --diff .")
        path = str(ROOT).replace(" ", "\ ") + "/pyproject.toml"
        in_py(
            context,
            f"flake8 --toml-config {path} .",
            "hatch run lint:all",
        )

Replace white space with \ so that os can locate the path which has while space

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions