Add plugin properties to settings cache key (#559)

This commit is contained in:
Charlie Marsh 2022-11-02 22:10:01 -04:00 committed by GitHub
parent 94597fefc1
commit d448281b33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 5 deletions

View file

@ -2,7 +2,7 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
pub enum Quote {
Single,
@ -18,7 +18,7 @@ pub struct Options {
pub avoid_escape: Option<bool>,
}
#[derive(Debug)]
#[derive(Debug, Hash)]
pub struct Settings {
pub inline_quotes: Quote,
pub multiline_quotes: Quote,

View file

@ -29,7 +29,7 @@ pub struct Options {
pub staticmethod_decorators: Option<Vec<String>>,
}
#[derive(Debug)]
#[derive(Debug, Hash)]
pub struct Settings {
pub ignore_names: Vec<String>,
pub classmethod_decorators: Vec<String>,

View file

@ -84,14 +84,19 @@ impl Settings {
impl Hash for Settings {
fn hash<H: Hasher>(&self, state: &mut H) {
self.line_length.hash(state);
// Add base properties in alphabetical order.
self.dummy_variable_rgx.as_str().hash(state);
for value in self.enabled.iter() {
value.hash(state);
}
self.line_length.hash(state);
for value in self.per_file_ignores.iter() {
value.hash(state);
}
self.target_version.hash(state);
// Add plugin properties in alphabetical order.
self.flake8_quotes.hash(state);
self.pep8_naming.hash(state);
}
}

View file

@ -11,7 +11,7 @@ use crate::checks::CheckCode;
use crate::checks_gen::CheckCodePrefix;
use crate::fs;
#[derive(Clone, Debug, PartialOrd, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialOrd, PartialEq, Eq, Serialize, Deserialize, Hash)]
pub enum PythonVersion {
Py33,
Py34,