{"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/d1087a4b9e03d253a88703f34e0869ee4b805456/crates/ruff/src/commands/show_settings.rs#L11-L42","documentation":"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'.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nruff show-settings docs/\n\n# after: point at a hierarchy with checkable Python files\nruff show-settings src/","handlingStrategy":"validation","validationCode":"from pathlib import Path\nimport sys\n\nroot = Path(sys.argv[1])\ncheckable = {'.py', '.pyi', '.ipynb'}\nassert (\n    root.is_file() and root.suffix in checkable\n    or root.is_dir() and any(p.suffix in checkable for p in root.rglob('*'))\n), 'no files for ruff show-settings to resolve'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["cli","show-settings","file-discovery","ruff"],"backgroundTag":"no-input-files-found","analyzedSha":"d1087a4b9e03d253a88703f34e0869ee4b805456","analyzedAt":"2026-08-20T16:33:49.445Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}