From ceabe8ecbaad2a490b13857f0614985e8e7b3455 Mon Sep 17 00:00:00 2001 From: Evgenii Date: Thu, 28 Dec 2023 10:51:00 +0300 Subject: [PATCH] =?UTF-8?q?chore:=20=D1=81hanged=20concatenation=20of=20st?= =?UTF-8?q?rings=20to=20f-strings=20to=20improve=20readability=20(#3227)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prowler/lib/outputs/html.py | 2 +- prowler/lib/outputs/slack.py | 4 ++-- .../apigateway_restapi_authorizers_enabled.py | 2 +- prowler/providers/common/audit_info.py | 2 +- tests/providers/common/common_outputs_test.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/prowler/lib/outputs/html.py b/prowler/lib/outputs/html.py index 820681b0..72ea3dd8 100644 --- a/prowler/lib/outputs/html.py +++ b/prowler/lib/outputs/html.py @@ -407,7 +407,7 @@ def get_azure_html_assessment_summary(audit_info): if isinstance(audit_info, Azure_Audit_Info): printed_subscriptions = [] for key, value in audit_info.identity.subscriptions.items(): - intermediate = key + " : " + value + intermediate = f"{key} : {value}" printed_subscriptions.append(intermediate) # check if identity is str(coming from SP) or dict(coming from browser or) diff --git a/prowler/lib/outputs/slack.py b/prowler/lib/outputs/slack.py index 1c8a8ad6..55720f86 100644 --- a/prowler/lib/outputs/slack.py +++ b/prowler/lib/outputs/slack.py @@ -13,7 +13,7 @@ def send_slack_message(token, channel, stats, provider, audit_info): response = client.chat_postMessage( username="Prowler", icon_url=square_logo_img, - channel="#" + channel, + channel=f"#{channel}", blocks=create_message_blocks(identity, logo, stats), ) return response @@ -35,7 +35,7 @@ def create_message_identity(provider, audit_info): elif provider == "azure": printed_subscriptions = [] for key, value in audit_info.identity.subscriptions.items(): - intermediate = "- *" + key + ": " + value + "*\n" + intermediate = f"- *{key}: {value}*\n" printed_subscriptions.append(intermediate) identity = f"Azure Subscriptions:\n{''.join(printed_subscriptions)}" logo = azure_logo diff --git a/prowler/providers/aws/services/apigateway/apigateway_restapi_authorizers_enabled/apigateway_restapi_authorizers_enabled.py b/prowler/providers/aws/services/apigateway/apigateway_restapi_authorizers_enabled/apigateway_restapi_authorizers_enabled.py index b1b1fd05..70cabcd3 100644 --- a/prowler/providers/aws/services/apigateway/apigateway_restapi_authorizers_enabled/apigateway_restapi_authorizers_enabled.py +++ b/prowler/providers/aws/services/apigateway/apigateway_restapi_authorizers_enabled/apigateway_restapi_authorizers_enabled.py @@ -35,7 +35,7 @@ class apigateway_restapi_authorizers_enabled(Check): if authorization_method == "NONE": all_methods_authorized = False unauthorized_method = ( - resource.path + " -> " + http_method + f"{resource.path} -> {http_method}" ) resource_paths_with_unathorized_methods.append( unauthorized_method diff --git a/prowler/providers/common/audit_info.py b/prowler/providers/common/audit_info.py index 39a7f0ce..421ab272 100644 --- a/prowler/providers/common/audit_info.py +++ b/prowler/providers/common/audit_info.py @@ -63,7 +63,7 @@ GCP Account: {Fore.YELLOW}[{profile}]{Style.RESET_ALL} GCP Project IDs: {Fore.Y def print_azure_credentials(self, audit_info: Azure_Audit_Info): printed_subscriptions = [] for key, value in audit_info.identity.subscriptions.items(): - intermediate = key + " : " + value + intermediate = f"{key} : {value}" printed_subscriptions.append(intermediate) report = f""" This report is being generated using the identity below: diff --git a/tests/providers/common/common_outputs_test.py b/tests/providers/common/common_outputs_test.py index d2d033b6..f0ccd388 100644 --- a/tests/providers/common/common_outputs_test.py +++ b/tests/providers/common/common_outputs_test.py @@ -281,7 +281,7 @@ class Test_Common_Output_Options: } printed_subscriptions = [] for key, value in audit_info.identity.subscriptions.items(): - intermediate = key + " : " + value + intermediate = f"{key} : {value}" printed_subscriptions.append(intermediate) assert ( get_assessment_summary(audit_info)