Skip to content

Commit fdcb28d

Browse files
committed
Cleanup rule rewrite (#3122)
1 parent 860b9fe commit fdcb28d

21 files changed

+59
-40
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""
2+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
SPDX-License-Identifier: MIT-0
4+
"""
5+
6+
from cfnlint.rules import CloudFormationLintRule
7+
8+
9+
class AnyOf(CloudFormationLintRule):
10+
"""Check Properties Resource Configuration"""
11+
12+
id = "E3017"
13+
shortdesc = "Check Properties that need at least one of a list of properties"
14+
description = (
15+
"Making sure CloudFormation properties "
16+
+ "that require at least one property from a list. "
17+
+ "More than one can be included."
18+
)
19+
source_url = "https://github.com/aws-cloudformation/cfn-python-lint"
20+
tags = ["resources"]

src/cfnlint/rules/resources/properties/DependentExcluded.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class DependentExcluded(CloudFormationLintRule):
1010
"""Check Required Resource Configuration"""
1111

12-
id = "E3023"
12+
id = "E3020"
1313
shortdesc = (
1414
"Validate that when a property is specified another property should be excluded"
1515
)

src/cfnlint/rules/resources/properties/DependentRequired.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class DependentExcluded(CloudFormationLintRule):
1010
"""Check Required Resource Configuration"""
1111

12-
id = "E3024"
12+
id = "E3021"
1313
shortdesc = (
1414
"Validate that when a property is specified that "
1515
"other properties should be included"

src/cfnlint/rules/resources/properties/AllowedValue.py renamed to src/cfnlint/rules/resources/properties/Enum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from cfnlint.rules import CloudFormationLintRule
88

99

10-
class AllowedValue(CloudFormationLintRule):
10+
class Enum(CloudFormationLintRule):
1111
"""Check if properties have a valid value"""
1212

1313
id = "E3030"

src/cfnlint/rules/resources/properties/NumberSize.py renamed to src/cfnlint/rules/resources/properties/MinMax.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from cfnlint.rules import CloudFormationLintRule
1313

1414

15-
class NumberSize(CloudFormationLintRule):
15+
class MinMax(CloudFormationLintRule):
1616
"""Check if a Number has a length within the limit"""
1717

1818
id = "E3034"

src/cfnlint/rules/resources/properties/StringSize.py renamed to src/cfnlint/rules/resources/properties/MinMaxLength.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from cfnlint.rules import CloudFormationLintRule
1515

1616

17-
class StringSize(CloudFormationLintRule):
17+
class MinMaxLength(CloudFormationLintRule):
1818
"""Check if a String has a length within the limit"""
1919

2020
id = "E3033"

src/cfnlint/rules/resources/properties/OnlyOne.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class OnlyOne(CloudFormationLintRule):
1010
"""Check Properties Resource Configuration"""
1111

12-
id = "E2523"
12+
id = "E3018"
1313
shortdesc = "Check Properties that need only one of a list of properties"
1414
description = (
1515
"Making sure CloudFormation properties "

src/cfnlint/rules/resources/properties/AllowedPattern.py renamed to src/cfnlint/rules/resources/properties/Pattern.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from cfnlint.rules import CloudFormationLintRule
1010

1111

12-
class AllowedPattern(CloudFormationLintRule):
12+
class Pattern(CloudFormationLintRule):
1313
"""Check if properties have a valid value"""
1414

1515
id = "E3031"

src/cfnlint/rules/resources/properties/Properties.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ def __init__(self):
2828
super().__init__()
2929
self.rule_set = {
3030
"additionalProperties": "E3002",
31+
"anyOf": "E3017",
3132
"properties": "E3002",
32-
"dependentExcluded": "E3023",
33-
"dependentRequired": "E3024",
33+
"dependentExcluded": "E3020",
34+
"dependentRequired": "E3021",
3435
"required": "E3003",
3536
"requiredXor": "E3014",
3637
"requiredOr": "E3015",
@@ -46,9 +47,9 @@ def __init__(self):
4647
"maxItems": "E3032",
4748
"minItems": "E3032",
4849
"pattern": "E3031",
49-
"oneOf": "E2523",
50+
"oneOf": "E3018",
5051
"cfnLint": "E1101",
51-
"tagging": "E3021",
52+
"tagging": "E3024",
5253
}
5354
self.child_rules = dict.fromkeys(list(self.rule_set.values()))
5455

src/cfnlint/rules/resources/properties/Tagging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
class Tagging(CloudFormationLintRule):
15-
id = "E3021"
15+
id = "E3024"
1616
shortdesc = "Validate tag configuration"
1717
description = (
1818
"Validates tag values to make sure they have unique keys "

0 commit comments

Comments
 (0)