Skip to content

Commit 7236d35

Browse files
committed
format file for linter
1 parent 836c1de commit 7236d35

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

dblinter/rules/T012/TableWithSensibleColumn.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ def table_with_sensible_column(
1515
anon = db.query(CHECK_EXTENSION)[0][0]
1616
if anon == 0:
1717
LOGGER.info(
18-
"TableWithSensibleColumn is enabled, but anon extension not found. in db %s. see https://postgresql-anonymizer.readthedocs.io to install", db.database
18+
"TableWithSensibleColumn is enabled, but anon extension not found. in db %s. see https://postgresql-anonymizer.readthedocs.io to install",
19+
db.database,
1920
)
2021
return
2122
SENSITIVE_COLS = f"""with coltable as (SELECT column_name,
@@ -36,11 +37,7 @@ def table_with_sensible_column(
3637
sensitive_cols = db.query(SENSITIVE_COLS)
3738
if sensitive_cols:
3839
for elt in sensitive_cols:
39-
message_args = (
40-
uri,
41-
elt[0],
42-
elt[1]
43-
)
40+
message_args = (uri, elt[0], elt[1])
4441
sarif_document.add_check(
4542
self.get_ruleid_from_function_name(), message_args, uri, context
4643
)

tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from testcontainers.core.waiting_utils import wait_container_is_ready
55
from testcontainers.postgres import PostgresContainer
66

7-
#PG_IMAGE = "registry.gitlab.com/dalibo/postgresql_anonymizer:latest"
7+
# PG_IMAGE = "registry.gitlab.com/dalibo/postgresql_anonymizer:latest"
88
PG_IMAGE = "postgres:14"
99
PG_PORT = 5432
1010
PG_USER = "postgres"
@@ -13,6 +13,7 @@
1313
PG_DRIVER = "psycopg2"
1414
LOGLEVEL = "WARNING"
1515

16+
1617
@wait_container_is_ready()
1718
@pytest.fixture(name="postgres_instance_args", scope="session")
1819
def get_pg_instance():

tests/rules/T012/test_TableWithSensibleColumn.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from dblinter.function_library import FunctionLibrary
44
from dblinter.sarif_document import SarifDocument
55

6+
67
def test_table_with_sensitive_column(postgres_instance_args) -> None:
78
args = postgres_instance_args
89
db = DatabaseConnection(args)
@@ -16,11 +17,11 @@ def test_table_with_sensitive_column(postgres_instance_args) -> None:
1617
fixes=[
1718
"Install extension anon, and create some masking rules on.",
1819
],
19-
message="{0} have column {1} (category {2}) that can be consider has sensitive. It should be masked for non data-operator users."
20+
message="{0} have column {1} (category {2}) that can be consider has sensitive. It should be masked for non data-operator users.",
2021
)
2122
function_library = FunctionLibrary()
22-
db.query('select anon.init()')
23-
db.query('CREATE TABLE test (id integer, creditcard text)')
23+
db.query("select anon.init()")
24+
db.query("CREATE TABLE test (id integer, creditcard text)")
2425
sarif_document = SarifDocument()
2526
function_library.get_function_by_function_name("table_with_sensible_column")(
2627
function_library, db, [], context, ("public", "test"), sarif_document
@@ -34,6 +35,7 @@ def test_table_with_sensitive_column(postgres_instance_args) -> None:
3435
== "postgres.public.test have column id (category account_id) that can be consider has sensitive. It should be masked for non data-operator users."
3536
)
3637

38+
3739
def test_table_without_sensitive_column(postgres_instance_args) -> None:
3840
args = postgres_instance_args
3941
db = DatabaseConnection(args)
@@ -47,11 +49,11 @@ def test_table_without_sensitive_column(postgres_instance_args) -> None:
4749
fixes=[
4850
"Install extension anon, and create some masking rules on.",
4951
],
50-
message="{0} have column {1} (category {2}) that can be consider has sensitive. It should be masked for non data-operator users."
52+
message="{0} have column {1} (category {2}) that can be consider has sensitive. It should be masked for non data-operator users.",
5153
)
5254
function_library = FunctionLibrary()
53-
db.query('select anon.init()')
54-
db.query('CREATE TABLE test (test_id integer, description text)')
55+
db.query("select anon.init()")
56+
db.query("CREATE TABLE test (test_id integer, description text)")
5557
sarif_document = SarifDocument()
5658
function_library.get_function_by_function_name("table_with_sensible_column")(
5759
function_library, db, [], context, ("public", "test"), sarif_document

0 commit comments

Comments
 (0)