Skip to content

Commit ba1cec9

Browse files
committed
fix: rename codegen stuff to pglt
1 parent 072562b commit ba1cec9

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

xtask/codegen/src/generate_analyser.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn generate_analyser() -> Result<()> {
1313
}
1414

1515
fn generate_linter() -> Result<()> {
16-
let base_path = project_root().join("crates/pg_analyser/src");
16+
let base_path = project_root().join("crates/pglt_analyser/src");
1717
let mut analysers = BTreeMap::new();
1818
generate_category("lint", &mut analysers, &base_path)?;
1919

@@ -39,7 +39,7 @@ fn generate_options(base_path: &Path) -> Result<()> {
3939
let rule_module_name = format_ident!("{}", rule_filename);
4040
let rule_name = format_ident!("{}", rule_name);
4141
rules_options.insert(rule_filename.to_string(), quote! {
42-
pub type #rule_name = <#category_name::#group_name::#rule_module_name::#rule_name as pg_analyse::Rule>::Options;
42+
pub type #rule_name = <#category_name::#group_name::#rule_module_name::#rule_name as pglt_analyse::Rule>::Options;
4343
});
4444
}
4545
}
@@ -120,7 +120,7 @@ fn generate_category(
120120
let (modules, paths): (Vec<_>, Vec<_>) = groups.into_values().unzip();
121121
let tokens = xtask::reformat(quote! {
122122
#( #modules )*
123-
::pg_analyse::declare_category! {
123+
::pglt_analyse::declare_category! {
124124
pub #category_name {
125125
kind: #kind,
126126
groups: [
@@ -173,7 +173,7 @@ fn generate_group(category: &'static str, group: &str, base_path: &Path) -> Resu
173173
let (import_macro, use_macro) = match category {
174174
"lint" => (
175175
quote!(
176-
use pg_analyse::declare_lint_group;
176+
use pglt_analyse::declare_lint_group;
177177
),
178178
quote!(declare_lint_group),
179179
),
@@ -200,12 +200,12 @@ fn generate_group(category: &'static str, group: &str, base_path: &Path) -> Resu
200200
}
201201

202202
fn update_linter_registry_builder(rules: BTreeMap<&'static str, TokenStream>) -> Result<()> {
203-
let path = project_root().join("crates/pg_analyser/src/registry.rs");
203+
let path = project_root().join("crates/pglt_analyser/src/registry.rs");
204204

205205
let categories = rules.into_values();
206206

207207
let tokens = xtask::reformat(quote! {
208-
use pg_analyse::RegistryVisitor;
208+
use pglt_analyse::RegistryVisitor;
209209

210210
pub fn visit_registry<V: RegistryVisitor>(registry: &mut V) {
211211
#( #categories )*

xtask/codegen/src/generate_configuration.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ impl RegistryVisitor for LintRulesVisitor {
3232
}
3333

3434
pub fn generate_rules_configuration(mode: Mode) -> Result<()> {
35-
let linter_config_root = project_root().join("crates/pg_configuration/src/analyser/linter");
36-
let push_rules_directory = project_root().join("crates/pg_configuration/src/generated");
35+
let linter_config_root = project_root().join("crates/pglt_configuration/src/analyser/linter");
36+
let push_rules_directory = project_root().join("crates/pglt_configuration/src/generated");
3737

3838
let mut lint_visitor = LintRulesVisitor::default();
3939
pglt_analyser::visit_registry(&mut lint_visitor);
@@ -102,8 +102,8 @@ fn generate_for_groups(
102102

103103
let severity_fn = if kind == RuleCategory::Action {
104104
quote! {
105-
/// Given a category coming from [Diagnostic](pg_diagnostics::Diagnostic), this function returns
106-
/// the [Severity](pg_diagnostics::Severity) associated to the rule, if the configuration changed it.
105+
/// Given a category coming from [Diagnostic](pglt_diagnostics::Diagnostic), this function returns
106+
/// the [Severity](pglt_diagnostics::Severity) associated to the rule, if the configuration changed it.
107107
/// If the severity is off or not set, then the function returns the default severity of the rule:
108108
/// [Severity::Error] for recommended rules and [Severity::Warning] for other rules.
109109
///
@@ -133,8 +133,8 @@ fn generate_for_groups(
133133
} else {
134134
quote! {
135135

136-
/// Given a category coming from [Diagnostic](pg_diagnostics::Diagnostic), this function returns
137-
/// the [Severity](pg_diagnostics::Severity) associated to the rule, if the configuration changed it.
136+
/// Given a category coming from [Diagnostic](pglt_diagnostics::Diagnostic), this function returns
137+
/// the [Severity](pglt_diagnostics::Severity) associated to the rule, if the configuration changed it.
138138
/// If the severity is off or not set, then the function returns the default severity of the rule:
139139
/// [Severity::Error] for recommended rules and [Severity::Warning] for other rules.
140140
///
@@ -173,20 +173,20 @@ fn generate_for_groups(
173173
let use_rule_configuration = if kind == RuleCategory::Action {
174174
quote! {
175175
use crate::analyser::{RuleAssistConfiguration, RuleAssistPlainConfiguration};
176-
use pg_analyse::{options::RuleOptions, RuleFilter};
176+
use pglt_analyse::{options::RuleOptions, RuleFilter};
177177
}
178178
} else {
179179
quote! {
180180
use crate::analyser::{RuleConfiguration, RulePlainConfiguration};
181-
use pg_analyse::{options::RuleOptions, RuleFilter};
181+
use pglt_analyse::{options::RuleOptions, RuleFilter};
182182
}
183183
};
184184

185185
let groups = if kind == RuleCategory::Action {
186186
quote! {
187187
#use_rule_configuration
188188
use biome_deserialize_macros::Merge;
189-
use pg_diagnostics::{Category, Severity};
189+
use pglt_diagnostics::{Category, Severity};
190190
use rustc_hash::FxHashSet;
191191
use serde::{Deserialize, Serialize};
192192
#[cfg(feature = "schema")]
@@ -226,7 +226,7 @@ fn generate_for_groups(
226226
}
227227

228228
impl Actions {
229-
/// Checks if the code coming from [pg_diagnostics::Diagnostic] corresponds to a rule.
229+
/// Checks if the code coming from [pglt_diagnostics::Diagnostic] corresponds to a rule.
230230
/// Usually the code is built like {group}/{rule_name}
231231
pub fn has_rule(
232232
group: RuleGroup,
@@ -266,7 +266,7 @@ fn generate_for_groups(
266266
quote! {
267267
#use_rule_configuration
268268
use biome_deserialize_macros::Merge;
269-
use pg_diagnostics::{Category, Severity};
269+
use pglt_diagnostics::{Category, Severity};
270270
use rustc_hash::FxHashSet;
271271
use serde::{Deserialize, Serialize};
272272
#[cfg(feature = "schema")]
@@ -314,7 +314,7 @@ fn generate_for_groups(
314314
}
315315

316316
impl Rules {
317-
/// Checks if the code coming from [pg_diagnostics::Diagnostic] corresponds to a rule.
317+
/// Checks if the code coming from [pglt_diagnostics::Diagnostic] corresponds to a rule.
318318
/// Usually the code is built like {group}/{rule_name}
319319
pub fn has_rule(
320320
group: RuleGroup,
@@ -380,7 +380,7 @@ fn generate_for_groups(
380380
RuleCategory::Lint => {
381381
quote! {
382382
use crate::analyser::linter::*;
383-
use pg_analyse::{AnalyserRules, MetadataRegistry};
383+
use pglt_analyse::{AnalyserRules, MetadataRegistry};
384384

385385
pub fn push_to_analyser_rules(
386386
rules: &Rules,
@@ -404,7 +404,7 @@ fn generate_for_groups(
404404
RuleCategory::Action => {
405405
quote! {
406406
use crate::analyser::assists::*;
407-
use pg_analyse::{AnalyserRules, MetadataRegistry};
407+
use pglt_analyse::{AnalyserRules, MetadataRegistry};
408408

409409
pub fn push_to_analyser_assists(
410410
rules: &Actions,
@@ -534,7 +534,7 @@ fn generate_group_struct(
534534
#rule
535535
});
536536
let rule_option_type = quote! {
537-
pg_analyser::options::#rule_name
537+
pglt_analyser::options::#rule_name
538538
};
539539
let rule_option = if kind == RuleCategory::Action {
540540
quote! { Option<#rule_config_type<#rule_option_type>> }

xtask/codegen/src/generate_new_analyser_rule.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ fn generate_rule_template(
2929
Category::Lint => "declare_lint_rule",
3030
};
3131
format!(
32-
r#"use pg_analyse::{{
32+
r#"use pglt_analyse::{{
3333
context::RuleContext, {macro_name}, Rule, RuleDiagnostic
3434
}};
35-
use pg_console::markup;
35+
use pglt_console::markup;
3636
3737
{macro_name}! {{
3838
/// Succinct description of the rule.
@@ -75,7 +75,7 @@ impl Rule for {rule_name_upper_camel} {{
7575

7676
pub fn generate_new_analyser_rule(category: Category, rule_name: &str, group: &str) {
7777
let rule_name_camel = Case::Camel.convert(rule_name);
78-
let crate_folder = project_root().join("crates/pg_analyser");
78+
let crate_folder = project_root().join("crates/pglt_analyser");
7979
let rule_folder = match &category {
8080
Category::Lint => crate_folder.join(format!("src/lint/{group}")),
8181
};
@@ -95,7 +95,7 @@ pub fn generate_new_analyser_rule(category: Category, rule_name: &str, group: &s
9595
);
9696
std::fs::write(file_name.clone(), code).unwrap_or_else(|_| panic!("To write {}", &file_name));
9797

98-
let categories_path = "crates/pg_diagnostics_categories/src/categories.rs";
98+
let categories_path = "crates/pglt_diagnostics_categories/src/categories.rs";
9999
let mut categories = std::fs::read_to_string(categories_path).unwrap();
100100

101101
if !categories.contains(&rule_name_camel) {

xtask/src/install.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ fn install_client(sh: &Shell, client_opt: ClientOpt) -> anyhow::Result<()> {
137137
}
138138

139139
fn install_server(sh: &Shell) -> anyhow::Result<()> {
140-
let cmd = cmd!(sh, "cargo install --path crates/pg_cli --locked --force");
140+
let cmd = cmd!(sh, "cargo install --path crates/pglt_cli --locked --force");
141141
cmd.run()?;
142142
Ok(())
143143
}

0 commit comments

Comments
 (0)