mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 14:52:01 +00:00
Add settings hash to cache (#20)
This commit is contained in:
parent
4c62e1e22e
commit
b63d66fc3e
7 changed files with 48 additions and 31 deletions
|
@ -1,15 +1,25 @@
|
|||
use std::collections::HashSet;
|
||||
use std::collections::BTreeSet;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use crate::checks::CheckCode;
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::checks::CheckCode;
|
||||
use crate::pyproject::load_config;
|
||||
|
||||
pub struct Settings {
|
||||
pub line_length: usize,
|
||||
pub exclude: Vec<PathBuf>,
|
||||
pub select: HashSet<CheckCode>,
|
||||
pub select: BTreeSet<CheckCode>,
|
||||
}
|
||||
|
||||
impl Hash for Settings {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.line_length.hash(state);
|
||||
for value in self.select.iter() {
|
||||
value.hash(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Settings {
|
||||
|
@ -30,7 +40,7 @@ impl Settings {
|
|||
})
|
||||
.collect(),
|
||||
select: config.select.unwrap_or_else(|| {
|
||||
HashSet::from([
|
||||
BTreeSet::from([
|
||||
CheckCode::F831,
|
||||
CheckCode::F541,
|
||||
CheckCode::F634,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue