From 1659350cd07159ccaac12570bdddcaddeee30af3 Mon Sep 17 00:00:00 2001 From: kiblik <5609770+kiblik@users.noreply.github.com> Date: Tue, 5 Nov 2024 03:47:59 +0100 Subject: [PATCH] Ruff: Add and fix S105 (#11068) Co-authored-by: Matt Tesauro --- dojo/models.py | 4 ++-- dojo/tools/trivy/parser.py | 2 +- dojo/tools/trivy_operator/secrets_handler.py | 2 +- ruff.toml | 7 +++++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dojo/models.py b/dojo/models.py index c780328ac8..c300483156 100644 --- a/dojo/models.py +++ b/dojo/models.py @@ -3576,9 +3576,9 @@ class Check_List(models.Model): @staticmethod def get_status(pass_fail): - if pass_fail == "Pass": + if pass_fail == "Pass": # noqa: S105 return "success" - if pass_fail == "Fail": + if pass_fail == "Fail": # noqa: S105 return "danger" return "warning" diff --git a/dojo/tools/trivy/parser.py b/dojo/tools/trivy/parser.py index 2e79c2b7e2..b8f4ddb0a2 100644 --- a/dojo/tools/trivy/parser.py +++ b/dojo/tools/trivy/parser.py @@ -34,7 +34,7 @@ SECRET_DESCRIPTION_TEMPLATE = """{title} **Category:** {category} **Match:** {match} -""" +""" # noqa: S105 LICENSE_DESCRIPTION_TEMPLATE = """{title} **Category:** {category} diff --git a/dojo/tools/trivy_operator/secrets_handler.py b/dojo/tools/trivy_operator/secrets_handler.py index a00c894a03..5dcd7a7bfe 100644 --- a/dojo/tools/trivy_operator/secrets_handler.py +++ b/dojo/tools/trivy_operator/secrets_handler.py @@ -11,7 +11,7 @@ SECRET_DESCRIPTION_TEMPLATE = """{title} **Category:** {category} **Match:** {match} -""" +""" # noqa: S105 class TrivySecretsHandler: diff --git a/ruff.toml b/ruff.toml index f996cf09f8..3a360f4989 100644 --- a/ruff.toml +++ b/ruff.toml @@ -41,7 +41,7 @@ select = [ "UP", "YTT", "ASYNC", - "S2", "S5", "S7", "S101", "S104", "S112", "S311", + "S2", "S5", "S7", "S101", "S104", "S105", "S112", "S311", "FBT001", "FBT003", "A003", "A004", "A006", "COM", @@ -99,7 +99,10 @@ fixable = ["ALL"] unfixable = [] preview = true -per-file-ignores = {} +[lint.per-file-ignores] +"unittests/**" = [ + "S105", # hardcoded passwords in tests are fine +] [lint.flake8-boolean-trap] extend-allowed-calls = ["dojo.utils.get_system_setting"]