From d6237241b24b55454c5adbd0e32e7c263ee75f7b Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Tue, 17 Dec 2024 15:24:56 -0800 Subject: [PATCH] Cleanup importing --- src/cfnlint/api.py | 3 +-- .../rules/parameters/DeploymentParameters.py | 10 ++++++++-- src/cfnlint/runner/__init__.py | 18 +++++++++++++++++- src/cfnlint/runner/cli.py | 2 ++ src/cfnlint/runner/deployment_file/__init__.py | 4 ++++ .../runner/deployment_file/deployment.py | 2 ++ .../deployment_types/git_sync.py | 2 ++ src/cfnlint/runner/exceptions.py | 2 ++ test/unit/module/rule/test_rule_child.py | 2 +- .../module/runner/test_rule_configuration.py | 3 +-- .../unit/module/runner/test_template_runner.py | 2 +- 11 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/cfnlint/api.py b/src/cfnlint/api.py index 303b60ee11..97151e6470 100644 --- a/src/cfnlint/api.py +++ b/src/cfnlint/api.py @@ -11,8 +11,7 @@ from cfnlint.decode.decode import decode_str from cfnlint.helpers import REGION_PRIMARY, REGIONS from cfnlint.rules import Match, RulesCollection -from cfnlint.runner import Runner -from cfnlint.runner.template import run_template_by_data +from cfnlint.runner import Runner, run_template_by_data Matches = List[Match] diff --git a/src/cfnlint/rules/parameters/DeploymentParameters.py b/src/cfnlint/rules/parameters/DeploymentParameters.py index e58cd84523..8c9dcfe6da 100644 --- a/src/cfnlint/rules/parameters/DeploymentParameters.py +++ b/src/cfnlint/rules/parameters/DeploymentParameters.py @@ -15,8 +15,14 @@ class DeploymentParameters(CfnLintJsonSchema): """Check if Parameters are configured correctly""" id = "E2900" - shortdesc = "Parameters have appropriate properties" - description = "Making sure the parameters are properly configured" + shortdesc = ( + "Validate deployment file parameters are valid against template parameters" + ) + description = ( + "Validates that required properties are provided, allowed values are " + "valid, types are correct, and the pattern matches in a deployment file " + "for the parameters specified in a template" + ) source_url = "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html" tags = ["parameters"] diff --git a/src/cfnlint/runner/__init__.py b/src/cfnlint/runner/__init__.py index cc46b961ef..7d5635920f 100644 --- a/src/cfnlint/runner/__init__.py +++ b/src/cfnlint/runner/__init__.py @@ -3,6 +3,22 @@ SPDX-License-Identifier: MIT-0 """ -__all__ = ["main", "Runner"] +__all__ = [ + "main", + "Runner", + "run_template_by_data", + "run_template_by_file_path", + "run_deployment_file", + "CfnLintExitException", + "InvalidRegionException", + "UnexpectedRuleException", +] from cfnlint.runner.cli import Runner, main +from cfnlint.runner.deployment_file import run_deployment_file +from cfnlint.runner.exceptions import ( + CfnLintExitException, + InvalidRegionException, + UnexpectedRuleException, +) +from cfnlint.runner.template import run_template_by_data, run_template_by_file_path diff --git a/src/cfnlint/runner/cli.py b/src/cfnlint/runner/cli.py index fa3fdc485b..31be056d4e 100644 --- a/src/cfnlint/runner/cli.py +++ b/src/cfnlint/runner/cli.py @@ -3,6 +3,8 @@ SPDX-License-Identifier: MIT-0 """ +from __future__ import annotations + import logging import os import sys diff --git a/src/cfnlint/runner/deployment_file/__init__.py b/src/cfnlint/runner/deployment_file/__init__.py index e5eda63b35..e0811bcbd6 100644 --- a/src/cfnlint/runner/deployment_file/__init__.py +++ b/src/cfnlint/runner/deployment_file/__init__.py @@ -2,3 +2,7 @@ Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: MIT-0 """ + +__all__ = ["run_deployment_file"] + +from cfnlint.runner.deployment_file.runner import run_deployment_file diff --git a/src/cfnlint/runner/deployment_file/deployment.py b/src/cfnlint/runner/deployment_file/deployment.py index 38a358bc5b..ce67716b4f 100644 --- a/src/cfnlint/runner/deployment_file/deployment.py +++ b/src/cfnlint/runner/deployment_file/deployment.py @@ -3,6 +3,8 @@ SPDX-License-Identifier: MIT-0 """ +from __future__ import annotations + from dataclasses import dataclass, field from typing import Any diff --git a/src/cfnlint/runner/deployment_file/deployment_types/git_sync.py b/src/cfnlint/runner/deployment_file/deployment_types/git_sync.py index cd3ed61a3a..f73ca2cde6 100644 --- a/src/cfnlint/runner/deployment_file/deployment_types/git_sync.py +++ b/src/cfnlint/runner/deployment_file/deployment_types/git_sync.py @@ -3,6 +3,8 @@ SPDX-License-Identifier: MIT-0 """ +from __future__ import annotations + from typing import Any from cfnlint.runner.deployment_file.deployment import Deployment diff --git a/src/cfnlint/runner/exceptions.py b/src/cfnlint/runner/exceptions.py index 9fb2f0ff72..f99d1d7e34 100644 --- a/src/cfnlint/runner/exceptions.py +++ b/src/cfnlint/runner/exceptions.py @@ -3,6 +3,8 @@ SPDX-License-Identifier: MIT-0 """ +from __future__ import annotations + class CfnLintExitException(Exception): """ diff --git a/test/unit/module/rule/test_rule_child.py b/test/unit/module/rule/test_rule_child.py index f254940863..0ec9452a1e 100644 --- a/test/unit/module/rule/test_rule_child.py +++ b/test/unit/module/rule/test_rule_child.py @@ -9,7 +9,7 @@ from cfnlint import ConfigMixIn from cfnlint.decode.decode import decode_str from cfnlint.rules import CloudFormationLintRule, Match, RuleMatch, Rules -from cfnlint.runner.template import run_template_by_data +from cfnlint.runner import run_template_by_data class TestCloudFormationRuleChild(BaseTestCase): diff --git a/test/unit/module/runner/test_rule_configuration.py b/test/unit/module/runner/test_rule_configuration.py index ee01c159ad..444ad341e1 100644 --- a/test/unit/module/runner/test_rule_configuration.py +++ b/test/unit/module/runner/test_rule_configuration.py @@ -7,8 +7,7 @@ from test.testlib.testcase import BaseTestCase from cfnlint.config import ConfigMixIn -from cfnlint.runner import Runner -from cfnlint.runner.exceptions import UnexpectedRuleException +from cfnlint.runner import Runner, UnexpectedRuleException class TestGetRules(BaseTestCase): diff --git a/test/unit/module/runner/test_template_runner.py b/test/unit/module/runner/test_template_runner.py index 4b3fdab4c0..6db2b74782 100644 --- a/test/unit/module/runner/test_template_runner.py +++ b/test/unit/module/runner/test_template_runner.py @@ -10,7 +10,7 @@ from cfnlint import ConfigMixIn from cfnlint.config import _DEFAULT_RULESDIR from cfnlint.rules import Rules -from cfnlint.runner.template import run_template_by_data +from cfnlint.runner import run_template_by_data class TestRunner(BaseTestCase):