mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 14:51:25 +00:00
Make the AST Checker pub(crate)
(#4498)
This commit is contained in:
parent
e9c6f16c56
commit
85f67b2ee3
5 changed files with 39 additions and 38 deletions
|
@ -76,7 +76,7 @@ def main(*, name: str, prefix: str, code: str, linter: str) -> None:
|
|||
contents = rules_mod.read_text()
|
||||
parts = contents.split("\n\n")
|
||||
|
||||
new_pub_use = f"pub use {rule_name_snake}::{{{rule_name_snake}, {name}}}"
|
||||
new_pub_use = f"pub(crate) use {rule_name_snake}::{{{rule_name_snake}, {name}}}"
|
||||
new_mod = f"mod {rule_name_snake};"
|
||||
|
||||
if len(parts) == 2:
|
||||
|
@ -105,6 +105,7 @@ use crate::checkers::ast::Checker;
|
|||
|
||||
#[violation]
|
||||
pub struct {name};
|
||||
|
||||
impl Violation for {name} {{
|
||||
#[derive_message_formats]
|
||||
fn message(&self) -> String {{
|
||||
|
@ -117,7 +118,7 @@ impl Violation for {name} {{
|
|||
fp.write(
|
||||
f"""
|
||||
/// {prefix}{code}
|
||||
pub fn {rule_name_snake}(checker: &mut Checker) {{}}
|
||||
pub(crate) fn {rule_name_snake}(checker: &mut Checker) {{}}
|
||||
""",
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue