structs 6/9: Automatically change CheckKind::* to violations::*

The changes in this commit were generated by running:

for f in $(find src -name '*.rs'); do sed -Ei 's/use crate::registry::.*;/\0use crate::violations;/g' $f; done
for f in $(find src -name '*.rs'); do sed -Ei 's/CheckKind::([A-Z])/violations::\1/g' $f; done
git checkout src/registry.rs src/lib.rs src/lib_wasm.rs src/violations.rs
cargo +nightly fmt
This commit is contained in:
Martin Fischer
2023-01-06 23:05:23 +01:00
committed by Charlie Marsh
parent 3c8fdbf107
commit 43db446dfa
182 changed files with 629 additions and 490 deletions

View File

@@ -3,6 +3,7 @@ use rustpython_ast::{Constant, Expr, ExprKind};
use crate::ast::types::Range;
use crate::checkers::ast::Checker;
use crate::registry::{Check, CheckCode, CheckKind};
use crate::violations;
/// EM101, EM102, EM103
pub fn string_in_exception(checker: &mut Checker, exc: &Expr) {
@@ -17,7 +18,7 @@ pub fn string_in_exception(checker: &mut Checker, exc: &Expr) {
if checker.settings.enabled.contains(&CheckCode::EM101) {
if string.len() > checker.settings.flake8_errmsg.max_string_length {
checker.checks.push(Check::new(
CheckKind::RawStringInException,
violations::RawStringInException,
Range::from_located(first),
));
}
@@ -27,7 +28,7 @@ pub fn string_in_exception(checker: &mut Checker, exc: &Expr) {
ExprKind::JoinedStr { .. } => {
if checker.settings.enabled.contains(&CheckCode::EM102) {
checker.checks.push(Check::new(
CheckKind::FStringInException,
violations::FStringInException,
Range::from_located(first),
));
}
@@ -38,7 +39,7 @@ pub fn string_in_exception(checker: &mut Checker, exc: &Expr) {
if let ExprKind::Attribute { value, attr, .. } = &func.node {
if attr == "format" && matches!(value.node, ExprKind::Constant { .. }) {
checker.checks.push(Check::new(
CheckKind::DotFormatInException,
violations::DotFormatInException,
Range::from_located(first),
));
}