Skip to content

Commit c9a0c69

Browse files
authored
feat(rules): add information context (#30)
1 parent 0a6318c commit c9a0c69

7 files changed

Lines changed: 404 additions & 117 deletions

File tree

dblinter.cfg

Lines changed: 152 additions & 33 deletions
Large diffs are not rendered by default.

dblinter/default_config.yaml

Lines changed: 106 additions & 42 deletions
Large diffs are not rendered by default.

tests/data/good_config.yaml

Lines changed: 141 additions & 37 deletions
Large diffs are not rendered by default.

tests/rules/B001/test_HowManyTableWithoutPrimaryKey.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def test_how_many_table_without_primary_key(postgres_instance_args) -> None:
1414
param = [{"warning": "50%"}]
1515
context = Context(
1616
desc="Count number of tables without primary key.",
17-
message="{0} table without primary key exceed the warning threshold: {1}%. Table list [{2}]",
17+
message="{0} table without primary key exceed the warning threshold: {1}%. Object list [{2}]",
1818
fixes=[
1919
"create a index on foreign key or change warning/error threshold.",
2020
],

tests/rules/B002/test_HowManyRedudantIndex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_how_many_redundant_index(postgres_instance_args) -> None:
4444
context = Context(
4545
desc="Count number of tables without index on foreign key.",
4646
fixes=["create a index on foreign key or change warning/error threshold."],
47-
message="{0} redundant(s) index exceed the warning threshold: {1}%. Index list [{2}]",
47+
message="{0} redundant(s) index exceed the warning threshold: {1}%. Object list [{2}]",
4848
)
4949

5050
sarif_document = SarifDocument()

tests/rules/T008/test_TableWithFkMismatch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def test_table_with_fk_mismatch_integer(postgres_instance_args) -> None:
88
args = postgres_instance_args
99
context = Context(
1010
desc="Count number of tables without index on foreign key.",
11-
fixes=["consider rewrite your model.", "ask a dba."],
11+
fixes=["Consider rewrite your model, ask a DBA"],
1212
message="Type constraint mismatch: {0} on {1} column {2} (type {3}/{4}) ref {5} column {6} type ({7}/{8})",
1313
)
1414
param = [{"size_mo": 1}]

tests/test_main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def test_main_with_schema_and_role_without_default_role_nok(
398398
schema="schema1",
399399
)
400400
assert (
401-
"No default role grantee on schema postgres.schema1. It means that each time a table is created, you must grant it to roles."
401+
"No default role granted on schema postgres.schema1. It means that each time a table is created, you must grant it to roles."
402402
in sarif_document.sarif_doc.runs[0].results[0].message.text
403403
)
404404

@@ -476,7 +476,7 @@ def test_main_with_schema_and_role_not_exist_nok(postgres_instance_args) -> None
476476
)
477477

478478
assert (
479-
"No role grantee on table postgres.schema1.e_table1. It means that except owner."
479+
"No role granted on table postgres.schema1.e_table1."
480480
in sarif_document.sarif_doc.runs[0].results[1].message.text
481481
)
482482

0 commit comments

Comments
 (0)