-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow for debug in .cfnlintrc file (#3898)
* Allow for debug in .cfnlintrc file
- Loading branch information
Showing
7 changed files
with
68 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,57 @@ | ||
class CfnLintError(Exception): | ||
class CfnLintExitException(Exception): | ||
""" | ||
The base exception class for cfn-lint exceptions. | ||
:ivar msg: The descriptive message associated with the error. | ||
An exception that is raised to indicate that the CloudFormation linter should exit. | ||
This exception is used to signal that the linter should exit | ||
with a specific exit code, typically indicating the severity | ||
of the issues found in the CloudFormation template. | ||
Attributes: | ||
exit_code (int): The exit code to be used when the linter exits. | ||
Methods: | ||
__init__(self, exit_code: int) -> None: | ||
Initialize a new CfnLintExitException instance with the specified exit code. | ||
""" | ||
|
||
fmt = "An unspecified error occurred" | ||
def __init__(self, msg=None, exit_code=1): | ||
""" | ||
Initialize a new CfnLintExitException instance with the specified exit code. | ||
Args: | ||
exit_code (int): The exit code to be used when the linter exits. | ||
""" | ||
if msg is None: | ||
msg = f"process failed with exit code {exit_code}" | ||
super().__init__(msg) | ||
self.exit_code = exit_code | ||
|
||
|
||
class InvalidRegionException(CfnLintExitException): | ||
""" | ||
An exception that is raised when an invalid AWS region is encountered. | ||
def __init__(self, **kwargs): | ||
msg = self.fmt.format(**kwargs) | ||
Exception.__init__(self, msg) | ||
self.kwargs = kwargs | ||
This exception is raised when the CloudFormation linter encounters a resource | ||
or parameter that references an AWS region that is not valid or supported. | ||
""" | ||
|
||
|
||
class UnexpectedRuleException(CfnLintExitException): | ||
""" | ||
An exception that is raised when an unexpected error occurs while loading rules. | ||
This exception is raised when the CloudFormation linter encounters an error | ||
while attempting to load custom rules or rules from a specified directory or | ||
module. This could be due to a variety of reasons, such as a missing file, | ||
a syntax error in the rule code, or an issue with the rule implementation. | ||
""" | ||
|
||
|
||
class DuplicateRuleError(CfnLintError): | ||
class DuplicateRuleError(CfnLintExitException): | ||
""" | ||
The data associated with a particular path could not be loaded. | ||
:ivar data_path: The data path that the user attempted to load. | ||
""" | ||
|
||
fmt = "Rule already included: {rule_id}" | ||
def __init__(self, rule_id: str): | ||
super().__init__(f"Rule already included: {rule_id}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters