Use a derive macro for Violations (#14557)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Micha Reiser 2024-11-27 10:41:40 +01:00 committed by GitHub
parent 6fd10e2fe7
commit 14ba469fc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
629 changed files with 2555 additions and 2562 deletions

View file

@ -93,7 +93,7 @@ def main(*, name: str, prefix: str, code: str, linter: str) -> None:
fp.write(
f"""\
use ruff_diagnostics::Violation;
use ruff_macros::{{derive_message_formats, violation}};
use ruff_macros::{{derive_message_formats, ViolationMetadata}};
use crate::checkers::ast::Checker;
@ -108,8 +108,8 @@ use crate::checkers::ast::Checker;
/// Use instead:
/// ```python
/// ```
#[violation]
pub struct {name};
#[derive(ViolationMetadata)]
pub(crate) struct {name};
impl Violation for {name} {{
#[derive_message_formats]