Add Python version support to ruff analyze CLI (#13426)

This commit is contained in:
Charlie Marsh 2024-09-20 15:40:47 -04:00 committed by GitHub
parent 2823487bf8
commit ff11db61b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 30 additions and 6 deletions

View file

@ -16,7 +16,10 @@ pub struct ModuleDb {
impl ModuleDb {
/// Initialize a [`ModuleDb`] from the given source root.
pub fn from_src_roots(mut src_roots: impl Iterator<Item = SystemPathBuf>) -> Result<Self> {
pub fn from_src_roots(
mut src_roots: impl Iterator<Item = SystemPathBuf>,
target_version: PythonVersion,
) -> Result<Self> {
let search_paths = {
// Use the first source root.
let src_root = src_roots
@ -37,7 +40,7 @@ impl ModuleDb {
Program::from_settings(
&db,
&ProgramSettings {
target_version: PythonVersion::default(),
target_version,
search_paths,
},
)?;