Skip to content
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

Ruff fails when attempting to produce an output file within a non-existent directory #11549

Closed
celestialorb opened this issue May 26, 2024 · 1 comment · Fixed by #11550
Closed
Assignees
Labels
bug Something isn't working

Comments

@celestialorb
Copy link

celestialorb commented May 26, 2024

I wasn't able to find a previously submitted issue surrounding this, apologies if I missed it.

Ruff fails (exit code 2) when trying to write to an output file (via --output-file) within a directory that doesn't exist with the following message:

ruff failed
  Cause: No such file or directory (os error 2)

I'd like to see Ruff automatically create the necessary directories to house the output file if they don't already exist rather than have to ensure the directory exists before invoking Ruff; or have Ruff have an option to automatically create the directories.

Reproducing the issue is fairly simple. Setting the --output-file flag to a filesystem location whose directories don't exist should do the trick (e.g. ruff check --isolated --output-file /tmp/does/not/exist/output.txt). This was tested on the latest Ruff (0.4.5). Creating the necessary directories (i.e. mkdir -p /tmp/does/not/exist) and then rerunning the command allows Ruff to succeed.

@charliermarsh charliermarsh self-assigned this May 26, 2024
@charliermarsh charliermarsh added the bug Something isn't working label May 26, 2024
@charliermarsh
Copy link
Member

Thanks, will fix this real quick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants