Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Smit-Parmar opened this issue Jun 8, 2023 · 2 comments · Fixed by #1023
Closed
Labels
flag-triage Not prioritized.

Comments

@Smit-Parmar
Copy link
Contributor

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

@rmorshea
Copy link
Collaborator

rmorshea commented Jun 8, 2023

Ok, I understand the issue.

I think the simplest solution would actually be to just quote the file path:

            f"flake8 --toml-config '{path}' .",

@Smit-Parmar
Copy link
Contributor Author

@rmorshea It worked thanks!. Can you please review the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flag-triage Not prioritized.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants