Skip to content

Commit

Permalink
Add Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jan 9, 2024
1 parent ad1b5c5 commit b54b1c1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ natord = { version = "1.0.9" }
notify = { version = "6.1.1" }
once_cell = { version = "1.19.0" }
path-absolutize = { version = "3.1.1" }
path-slash = { version = "0.2.1" }
pathdiff = { version = "0.2.1" }
pep440_rs = { version = "0.4.0", features = ["serde"] }
pretty_assertions = "1.3.0"
Expand Down
1 change: 1 addition & 0 deletions crates/ruff_workspace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ log = { workspace = true }
matchit = { workspace = true }
once_cell = { workspace = true }
path-absolutize = { workspace = true }
path-slash = { workspace = true }
pep440_rs = { workspace = true, features = ["serde"] }
regex = { workspace = true }
rustc-hash = { workspace = true }
Expand Down
6 changes: 4 additions & 2 deletions crates/ruff_workspace/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use itertools::Itertools;
use log::debug;
use matchit::{InsertError, Router};
use path_absolutize::path_dedot;
use path_slash::PathExt;
use rustc_hash::{FxHashMap, FxHashSet};

use ruff_linter::fs;
Expand Down Expand Up @@ -105,8 +106,9 @@ impl Resolver {
/// Add a resolved [`Settings`] under a given [`PathBuf`] scope.
fn add(&mut self, path: &Path, settings: Settings) -> Result<()> {
self.settings.push(settings);
println!("path: {:?}", path.to_slash_lossy());
match self.router.insert(
format!("{}/*filepath", path.to_string_lossy()),
format!("{}/*filepath", path.to_slash_lossy()),
self.settings.len() - 1,
) {
Ok(()) => Ok(()),
Expand All @@ -125,7 +127,7 @@ impl Resolver {
PyprojectDiscoveryStrategy::Fixed => &pyproject_config.settings,
PyprojectDiscoveryStrategy::Hierarchical => self
.router
.at(&path.to_string_lossy())
.at(&path.to_slash_lossy())
.map(|match_| &self.settings[*match_.value])
.unwrap_or(&pyproject_config.settings),
}
Expand Down

0 comments on commit b54b1c1

Please sign in to comment.