From 58cc22e44cfaf8dc9072826a1b4c08a1d0af3312 Mon Sep 17 00:00:00 2001 From: kiblik <5609770+kiblik@users.noreply.github.com> Date: Mon, 14 Oct 2024 18:03:36 +0200 Subject: [PATCH] Ruff: Add and fix S105 --- 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 b4a163f1a78..9713ab5fa82 100644 --- a/dojo/models.py +++ b/dojo/models.py @@ -3568,9 +3568,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 2e79c2b7e23..b8f4ddb0a2d 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 c5e767a1bc5..738b52f7ac7 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 cb7e9231257..cf55f463811 100644 --- a/ruff.toml +++ b/ruff.toml @@ -41,7 +41,7 @@ select = [ "UP", "YTT", "ASYNC", - "S2", "S5", "S7", "S101", "S112", "S311", + "S2", "S5", "S7", "S101", "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"]