From de05d910e111384029dd8fd2ac81186dc982e21c Mon Sep 17 00:00:00 2001 From: Pepe Fagoaga Date: Thu, 30 Jan 2025 11:44:50 +0100 Subject: [PATCH] chore: rename Check_Report to CheckReport --- prowler/lib/check/models.py | 12 ++++++------ prowler/lib/outputs/compliance/compliance.py | 6 +++--- prowler/lib/outputs/finding.py | 6 +++--- tests/lib/check/models_test.py | 6 +++--- tests/lib/outputs/compliance/compliance_test.py | 10 +++++----- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/prowler/lib/check/models.py b/prowler/lib/check/models.py index 29a3bc44f3..3295382646 100644 --- a/prowler/lib/check/models.py +++ b/prowler/lib/check/models.py @@ -399,7 +399,7 @@ class Check(ABC, CheckMetadata): @dataclass -class Check_Report: +class CheckReport: """Contains the Check's finding information.""" status: str @@ -440,7 +440,7 @@ class Check_Report: @dataclass -class Check_Report_AWS(Check_Report): +class Check_Report_AWS(CheckReport): """ Contains the AWS Check's finding information. @@ -470,7 +470,7 @@ class Check_Report_AWS(Check_Report): @dataclass -class Check_Report_Azure(Check_Report): +class Check_Report_Azure(CheckReport): """Contains the Azure Check's finding information.""" resource_name: str @@ -502,7 +502,7 @@ class Check_Report_Azure(Check_Report): @dataclass -class Check_Report_GCP(Check_Report): +class Check_Report_GCP(CheckReport): """Contains the GCP Check's finding information.""" resource_name: str @@ -537,7 +537,7 @@ class Check_Report_GCP(Check_Report): @dataclass -class Check_Report_Kubernetes(Check_Report): +class Check_Report_Kubernetes(CheckReport): # TODO change class name to CheckReportKubernetes """Contains the Kubernetes Check's finding information.""" @@ -557,7 +557,7 @@ class Check_Report_Kubernetes(Check_Report): @dataclass -class Check_Report_Microsoft365(Check_Report): +class Check_Report_Microsoft365(CheckReport): """Contains the Microsoft365 Check's finding information.""" resource_name: str diff --git a/prowler/lib/outputs/compliance/compliance.py b/prowler/lib/outputs/compliance/compliance.py index b74eafa97f..687047dcc7 100644 --- a/prowler/lib/outputs/compliance/compliance.py +++ b/prowler/lib/outputs/compliance/compliance.py @@ -1,6 +1,6 @@ import sys -from prowler.lib.check.models import Check_Report +from prowler.lib.check.models import CheckReport from prowler.lib.logger import logger from prowler.lib.outputs.compliance.cis.cis import get_cis_table from prowler.lib.outputs.compliance.ens.ens import get_ens_table @@ -90,7 +90,7 @@ def display_compliance_table( # TODO: this should be in the Check class def get_check_compliance( - finding: Check_Report, provider_type: str, bulk_checks_metadata: dict + finding: CheckReport, provider_type: str, bulk_checks_metadata: dict ) -> dict: """get_check_compliance returns a map with the compliance framework as key and the requirements where the finding's check is present. @@ -102,7 +102,7 @@ def get_check_compliance( } Args: - finding (Any): The Check_Report finding + finding (Any): The CheckReport finding provider_type (str): The provider type bulk_checks_metadata (dict): The bulk checks metadata diff --git a/prowler/lib/outputs/finding.py b/prowler/lib/outputs/finding.py index 62c5cfe47d..2db23b4fdf 100644 --- a/prowler/lib/outputs/finding.py +++ b/prowler/lib/outputs/finding.py @@ -4,7 +4,7 @@ from typing import Optional, Union from pydantic import BaseModel, Field, ValidationError from prowler.config.config import prowler_version -from prowler.lib.check.models import Check_Report, CheckMetadata +from prowler.lib.check.models import CheckMetadata, CheckReport from prowler.lib.logger import logger from prowler.lib.outputs.common import Status, fill_common_finding_data from prowler.lib.outputs.compliance.compliance import get_check_compliance @@ -91,13 +91,13 @@ class Finding(BaseModel): @classmethod def generate_output( - cls, provider: Provider, check_output: Check_Report, output_options + cls, provider: Provider, check_output: CheckReport, output_options ) -> "Finding": """Generates the output for a finding based on the provider and output options Args: provider (Provider): the provider object - check_output (Check_Report): the check output object + check_output (CheckReport): the check output object output_options: the output options object, depending on the provider Returns: finding_output (Finding): the finding output object diff --git a/tests/lib/check/models_test.py b/tests/lib/check/models_test.py index f8d5014657..059d495ed6 100644 --- a/tests/lib/check/models_test.py +++ b/tests/lib/check/models_test.py @@ -3,10 +3,10 @@ from unittest import mock import pytest from prowler.lib.check.models import ( - Check_Report, Check_Report_AWS, Check_Report_Azure, CheckMetadata, + CheckReport, ) from tests.lib.check.compliance_check_test import custom_compliance_metadata @@ -335,7 +335,7 @@ class TestCheckMetada: class TestCheckReport: def test_check_report_resource_dict(self): resource = {"id": "test_id"} - check_report = Check_Report(metadata=mock_metadata.json(), resource=resource) + check_report = CheckReport(metadata=mock_metadata.json(), resource=resource) assert check_report.status == "" assert check_report.check_metadata == mock_metadata assert check_report.resource == resource @@ -347,7 +347,7 @@ class TestCheckReport: # def test_check_report_resource_dict_method(self): # resource = mock.Mock() # resource.dict = lambda: {"id": "test_id"} - # check_report = Check_Report(metadata=mock_metadata.json(), resource=resource) + # check_report = CheckReport(metadata=mock_metadata.json(), resource=resource) # assert check_report.status == "" # assert check_report.check_metadata == mock_metadata # assert check_report.resource == {"id": "test_id"} diff --git a/tests/lib/outputs/compliance/compliance_test.py b/tests/lib/outputs/compliance/compliance_test.py index d9458bc6b0..963cf58094 100644 --- a/tests/lib/outputs/compliance/compliance_test.py +++ b/tests/lib/outputs/compliance/compliance_test.py @@ -6,7 +6,7 @@ from prowler.lib.check.compliance_models import ( Compliance, Compliance_Requirement, ) -from prowler.lib.check.models import Check_Report, load_check_metadata +from prowler.lib.check.models import CheckReport, load_check_metadata from prowler.lib.outputs.compliance.compliance import get_check_compliance @@ -69,7 +69,7 @@ class TestCompliance: ), ] - finding = Check_Report( + finding = CheckReport( metadata=load_check_metadata( f"{path.dirname(path.realpath(__file__))}/../fixtures/metadata.json" ).json(), @@ -149,7 +149,7 @@ class TestCompliance: ), ] - finding = Check_Report( + finding = CheckReport( metadata=load_check_metadata( f"{path.dirname(path.realpath(__file__))}/../fixtures/metadata.json" ).json(), @@ -229,7 +229,7 @@ class TestCompliance: ), ] - finding = Check_Report( + finding = CheckReport( metadata=load_check_metadata( f"{path.dirname(path.realpath(__file__))}/../fixtures/metadata.json" ).json(), @@ -309,7 +309,7 @@ class TestCompliance: ), ] - finding = Check_Report( + finding = CheckReport( metadata=load_check_metadata( f"{path.dirname(path.realpath(__file__))}/../fixtures/metadata.json" ).json(),