{"record":{"id":"fe4ceda882460435","repo":"astral-sh/ruff","slug":"no-files-found-under-the-given-path","errorCode":null,"errorMessage":"No files found under the given path","messagePattern":"No files found under the given path","errorType":"console","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/ruff/src/commands/show_settings.rs","lineNumber":29,"sourceCode":"/// Print the user-facing configuration settings.\npub(crate) fn show_settings(\n    files: &[PathBuf],\n    pyproject_config: &PyprojectConfig,\n    config_arguments: &ConfigArguments,\n    writer: &mut impl Write,\n) -> Result<()> {\n    // Collect all files in the hierarchy.\n    let (paths, resolver) = project_files_in_path(files, pyproject_config, config_arguments)?;\n\n    // Print the list of files.\n    let Some(path) = paths\n        .into_iter()\n        .flatten()\n        .map(ResolvedFile::into_path)\n        .sorted_unstable()\n        .next()\n    else {\n        bail!(\"No files found under the given path\");\n    };\n\n    let (settings, config_path) = resolver.resolve_with_path(&path);\n\n    writeln!(writer, \"Resolved settings for: \\\"{}\\\"\", path.display())?;\n    if let Some(settings_path) = config_path {\n        writeln!(writer, \"Settings path: \\\"{}\\\"\", settings_path.display())?;\n    }\n    write!(writer, \"{settings}\")?;\n\n    Ok(())\n}\n","sourceCodeStart":11,"sourceCodeEnd":42,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ruff/src/commands/show_settings.rs#L11-L42","documentation":"The `ruff show-settings` command resolves settings for a file under the given path; it requires at least one resolved file to determine which file's effective settings to display. If the provided path yields no files (after exclusion), the command bails with this error.","triggerScenarios":"Running `ruff show-settings <path>` where the path matches no Python files — the directory is empty, all files are excluded by configuration, the glob matches nothing, or the path points at ignored directories.","commonSituations":"Typoed or wrong directory paths; running show-settings on directories whose contents are excluded via `exclude`/`extend-exclude` settings; empty repos or paths filtered out by respect-gitignore.","solutions":["Pass a path that contains at least one (non-excluded) Python file.","Check your `exclude`/`extend-exclude`/gitignore settings to confirm the target files are not being filtered out.","Verify the path is spelled correctly relative to the current working directory."],"exampleFix":"// before\nruff show-settings ./empty-dir\n// after\nruff show-settings ./src","handlingStrategy":"validation","validationCode":"# Verify the path yields at least one non-excluded Python file first:\nimport subprocess\nout = subprocess.run(['ruff', 'check', path, '--no-cache'], capture_output=True, text=True)\nif 'No Python files found' in out.stdout + out.stderr:\n    raise SystemExit(f'{path} matches no lintable files; show-settings would fail')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run show-settings on directories known to contain Python files.","Check exclude/extend-exclude/gitignore rules before debugging settings on a path.","Test with `ruff check <path>` first; if it finds no files, show-settings will fail too."],"tags":["cli","configuration","ruff","paths"],"backgroundTag":"no-files-matched","analyzedSha":"26f38c119cac42e4d320ba08f09224fdec74af2c","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}