astral-sh/ruff · error · anyhow::Error
No files found under the given path
Error message
No files found under the given path
What it means
ruff show-settings <PATH> prints the resolved configuration by picking the first (sorted) file that would actually be checked under PATH and showing the settings in effect for it. project_files_in_path() applies the same discovery as ruff check (include/exclude settings, gitignore respect), so if the hierarchy yields zero checkable files the command bails with 'No files found under the given path'.
Source
Thrown at crates/ruff/src/commands/show_settings.rs:29
/// Print the user-facing configuration settings.
pub(crate) fn show_settings(
files: &[PathBuf],
pyproject_config: &PyprojectConfig,
config_arguments: &ConfigArguments,
writer: &mut impl Write,
) -> Result<()> {
// Collect all files in the hierarchy.
let (paths, resolver) = project_files_in_path(files, pyproject_config, config_arguments)?;
// Print the list of files.
let Some(path) = paths
.into_iter()
.flatten()
.map(ResolvedFile::into_path)
.sorted_unstable()
.next()
else {
bail!("No files found under the given path");
};
let (settings, config_path) = resolver.resolve_with_path(&path);
writeln!(writer, "Resolved settings for: \"{}\"", path.display())?;
if let Some(settings_path) = config_path {
writeln!(writer, "Settings path: \"{}\"", settings_path.display())?;
}
write!(writer, "{settings}")?;
Ok(())
}
View on GitHub (pinned to d1087a4b9e)
Solutions
- Point at a hierarchy that contains checkable files, or pass a file directly: ruff show-settings src/main.py.
- Inspect exclude / extend-exclude / include settings and the gitignore status of the files you expected to be collected.
- Confirm what ruff actually collects with ruff check <path> --statistics (or verbose logging) before show-settings.
- Fix typos in the path.
Example fix
# before ruff show-settings docs/ # after: point at a hierarchy with checkable Python files ruff show-settings src/
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
import sys
root = Path(sys.argv[1])
checkable = {'.py', '.pyi', '.ipynb'}
assert (
root.is_file() and root.suffix in checkable
or root.is_dir() and any(p.suffix in checkable for p in root.rglob('*'))
), 'no files for ruff show-settings to resolve' Prevention
- Run show-settings against a path known to contain Python files, or pass a file directly.
- Remember discovery honors exclude/extend-exclude and gitignore; verify collection with ruff check <path> --statistics first.
- Keep at least one .py/.pyi file in directories used for config demonstrations.
When it happens
Trigger: ruff show-settings on an empty directory; a directory whose only files are excluded by exclude/extend-exclude or gitignored; a path containing no .py/.pyi/.ipynb files (docs or config-only dirs); a mistyped path.
Common situations: Trying show-settings on a fresh scaffold before any Python file exists; demonstrating config for a subfolder that is entirely excluded; pointing at directories where ruff's gitignore respect filters everything out.
Related errors
- The argument `--config={}` cannot be used with `--isolated`
- You cannot specify more than one configuration file on the c
- Unsupported serialization format for statistics: {:?}
- Unknown option: {key}
- The `--range` option is only supported when formatting a sin
AI-assisted analysis of astral-sh/ruff@d1087a4b9e (2026-08-20).
Data as JSON: /api/errors/fe4ceda882460435.
Report an issue: GitHub.