Skip to content

docs: fix links to rules #467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions crates/pgt_diagnostics_categories/src/categories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
// must be between `define_categories! {\n` and `\n ;\n`.

define_categories! {
"lint/safety/addingRequiredField": "https://pglt.dev/linter/rules/adding-required-field",
"lint/safety/banDropColumn": "https://pglt.dev/linter/rules/ban-drop-column",
"lint/safety/banDropDatabase": "https://pgtools.dev/linter/rules/ban-drop-database",
"lint/safety/banDropNotNull": "https://pglt.dev/linter/rules/ban-drop-not-null",
"lint/safety/banDropTable": "https://pglt.dev/linter/rules/ban-drop-table",
"lint/safety/banTruncateCascade": "https://pgtools.dev/linter/rules/ban-truncate-cascade",
"lint/safety/addingRequiredField": "https://pgtools.dev/latest/rules/adding-required-field",
"lint/safety/banDropColumn": "https://pgtools.dev/latest/rules/ban-drop-column",
"lint/safety/banDropDatabase": "https://pgtools.dev/latest/rules/ban-drop-database",
"lint/safety/banDropNotNull": "https://pgtools.dev/latest/rules/ban-drop-not-null",
"lint/safety/banDropTable": "https://pgtools.dev/latest/rules/ban-drop-table",
"lint/safety/banTruncateCascade": "https://pgtools.dev/latest/rules/ban-truncate-cascade",
// end lint rules
;
// General categories
Expand Down
2 changes: 1 addition & 1 deletion docs/codegen/src/rules_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn generate_group(

write!(
content,
"| [{rule_name}](/rules/{dashed_rule}) | {summary} | {properties} |"
"| [{rule_name}](./{dashed_rule}) | {summary} | {properties} |"
)?;

writeln!(content)?;
Expand Down
4 changes: 2 additions & 2 deletions docs/codegen/src/rules_sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ pub fn generate_rule_sources(docs_dir: &Path) -> anyhow::Result<()> {
for (rule_name, metadata) in rules {
let kebab_rule_name = Case::Kebab.convert(rule_name);
if metadata.sources.is_empty() {
exclusive_rules.insert((rule_name.to_string(), format!("./rules/{kebab_rule_name}")));
exclusive_rules.insert((rule_name.to_string(), format!("../rules/{kebab_rule_name}")));
} else {
for source in metadata.sources {
let source_set = SourceSet {
rule_name: rule_name.to_string(),
link: format!("./rules/{kebab_rule_name}"),
link: format!("../rules/{kebab_rule_name}"),
source_link: source.to_rule_url(),
source_rule_name: source.as_rule_name().to_string(),
};
Expand Down
12 changes: 6 additions & 6 deletions docs/rule_sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
### Squawk
| Squawk Rule Name | Rule Name |
| ---- | ---- |
| [adding-required-field](https://squawkhq.com/docs/adding-required-field) |[addingRequiredField](./rules/adding-required-field) |
| [ban-drop-column](https://squawkhq.com/docs/ban-drop-column) |[banDropColumn](./rules/ban-drop-column) |
| [ban-drop-database](https://squawkhq.com/docs/ban-drop-database) |[banDropDatabase](./rules/ban-drop-database) |
| [ban-drop-not-null](https://squawkhq.com/docs/ban-drop-not-null) |[banDropNotNull](./rules/ban-drop-not-null) |
| [ban-drop-table](https://squawkhq.com/docs/ban-drop-table) |[banDropTable](./rules/ban-drop-table) |
| [ban-truncate-cascade](https://squawkhq.com/docs/ban-truncate-cascade) |[banTruncateCascade](./rules/ban-truncate-cascade) |
| [adding-required-field](https://squawkhq.com/docs/adding-required-field) |[addingRequiredField](../rules/adding-required-field) |
| [ban-drop-column](https://squawkhq.com/docs/ban-drop-column) |[banDropColumn](../rules/ban-drop-column) |
| [ban-drop-database](https://squawkhq.com/docs/ban-drop-database) |[banDropDatabase](../rules/ban-drop-database) |
| [ban-drop-not-null](https://squawkhq.com/docs/ban-drop-not-null) |[banDropNotNull](../rules/ban-drop-not-null) |
| [ban-drop-table](https://squawkhq.com/docs/ban-drop-table) |[banDropTable](../rules/ban-drop-table) |
| [ban-truncate-cascade](https://squawkhq.com/docs/ban-truncate-cascade) |[banTruncateCascade](../rules/ban-truncate-cascade) |
12 changes: 6 additions & 6 deletions docs/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ Rules that detect potential safety issues in your code.

| Rule name | Description | Properties |
| --- | --- | --- |
| [addingRequiredField](/rules/adding-required-field) | Adding a new column that is NOT NULL and has no default value to an existing table effectively makes it required. | |
| [banDropColumn](/rules/ban-drop-column) | Dropping a column may break existing clients. | ✅ |
| [banDropDatabase](/rules/ban-drop-database) | Dropping a database may break existing clients (and everything else, really). | |
| [banDropNotNull](/rules/ban-drop-not-null) | Dropping a NOT NULL constraint may break existing clients. | ✅ |
| [banDropTable](/rules/ban-drop-table) | Dropping a table may break existing clients. | ✅ |
| [banTruncateCascade](/rules/ban-truncate-cascade) | Using `TRUNCATE`'s `CASCADE` option will truncate any tables that are also foreign-keyed to the specified tables. | |
| [addingRequiredField](./adding-required-field) | Adding a new column that is NOT NULL and has no default value to an existing table effectively makes it required. | |
| [banDropColumn](./ban-drop-column) | Dropping a column may break existing clients. | ✅ |
| [banDropDatabase](./ban-drop-database) | Dropping a database may break existing clients (and everything else, really). | |
| [banDropNotNull](./ban-drop-not-null) | Dropping a NOT NULL constraint may break existing clients. | ✅ |
| [banDropTable](./ban-drop-table) | Dropping a table may break existing clients. | ✅ |
| [banTruncateCascade](./ban-truncate-cascade) | Using `TRUNCATE`'s `CASCADE` option will truncate any tables that are also foreign-keyed to the specified tables. | |

[//]: # (END RULES_INDEX)

Expand Down
2 changes: 1 addition & 1 deletion xtask/codegen/src/generate_new_analyser_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub fn generate_new_analyser_rule(
// We sort rules to reduce conflicts between contributions made in parallel.
let rule_line = match category {
Category::Lint => format!(
r#" "lint/{group}/{rule_name_camel}": "https://pgtools.dev/linter/rules/{kebab_case_rule}","#
r#" "lint/{group}/{rule_name_camel}": "https://pgtools.dev/latest/rules/{kebab_case_rule}","#
),
};
let lint_start = match category {
Expand Down