Skip to content

Commit f7ad7de

Browse files
E3012 documentation changes for more clarity (#2747)
* documentation changes for clarity
1 parent c6f11a4 commit f7ad7de

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Optional parameters:
186186
| -c, --include-checks | | INCLUDE_CHECKS [INCLUDE_CHECKS ...] | Include rules whose id match these values
187187
| -m, --mandatory-checks | | | Rules to check regardless of ignore configuration |
188188
| --non-zero-exit-code | | informational (default), warning, error, none] | Exit code will be non zero from the specified rule class and higher |
189-
| -x, --configure-rule | | CONFIGURE_RULES [CONFIGURE_RULES ...] | Provide configuration for a rule. Format RuleId:key=value. Example: E3012:strict=false
189+
| -x, --configure-rule | | CONFIGURE_RULES [CONFIGURE_RULES ...] | Provide configuration for a rule. Format RuleId:key=value. Example: E3012:strict=true
190190
| -D, --debug | | | Specify to enable debug logging. Debug logging outputs detailed information about rules processing, useful for debugging rules. |
191191
| -I, --info | | | Specify to enable logging. Outputs additional information about the template processing. |
192192
| -u, --update-specs | | | Update the [CloudFormation Resource Specifications](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html). You may need sudo to run this. You will need internet access when running this command |
@@ -243,7 +243,7 @@ cfn-lint applies configurations from several sources. The rules at lower levels
243243

244244
Certain rules support configuration properties. You can configure these rules by using `configure_rules` parameter.
245245

246-
From the command line the format is `RuleId:key=value`, for example: `E3012:strict=false`.
246+
From the command line the format is `RuleId:key=value`, for example: `E3012:strict=true`.
247247
From the cfnlintrc or Metadata section the format is
248248

249249
```yaml

docs/cfn-resource-specification.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ There are multiple rules that are based on information from the specification fi
1010
The Required rule ([`E3003`](/docs/rules.md#E3003)) checks if properties that are marked as required in the [property specifications](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification-format.html#cfn-resource-specification-format-propertytypes) are specified.
1111

1212
### ValuePrimitiveType
13-
The ValuePrimitiveType rule ([`E3012`](/docs/rules.md#E3012)) checks if the value of a property is of the same type as specified in the [property specifications](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification-format.html#cfn-resource-specification-format-propertytypes) thus enforcing strict typing of CloudFormation templates. In short this means a number is a number, string is a string, etc.
13+
The ValuePrimitiveType rule ([`E3012`](/docs/rules.md#E3012)) checks if the value of a property is of the same type as specified in the [property specifications](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification-format.html#cfn-resource-specification-format-propertytypes) thus enforcing strict typing of CloudFormation templates. In short this means a number is a number, string is a string, etc. By default, strict typing is **NOT** enforced.
1414

1515
Although there are situations in which a warning would be sufficient (Python/YAML does implicit conversions) this could also result in errors (More information in issues [42](https://github.com/aws-cloudformation/cfn-python-lint/issues/42) and [180](https://github.com/aws-cloudformation/cfn-python-lint/issues/180)). Since the Specification contains a mapping to the underlying API's this is out of control of cfn-lint. cfn-lint doesn't have an exception process so all instances of this issue are considered errors.
1616

docs/rules.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Informational results start with the letter `I`. Informational alert you when th
2727
| (E|W|I)9xxx | Reserved for users rules |
2828

2929
*Warning*
30-
Rule `E3012` is used to check the types for value of a resource property. A number is a number, string is a string, etc. There are occasions where this could be just a warning and other times it could be an error. cfn-lint doesn't have an exception process so all instances of this issue are considered errors. You can disable this rule using `--ignore-checks` if it is not required for your internal best practices.
30+
Rule `E3012` is used to check the types for value of a resource property. A number is a number, string is a string, etc. There are occasions where this could be just a warning and other times it could be an error. cfn-lint doesn't have an exception process so all instances of this issue are considered errors. You can disable this rule using `--ignore-checks` if it is not required for your internal best practices. Conversely, strict typing is **NOT** enforced by default for this rule, so if strict adherence to resource value types is necessary for your use case, you can use `--configure-rule E3012:strict=true` to enforce the rule.
3131

3232
## Experimental rules
3333
Sometimes there are (new) rules that might be complex, that doesn't have enough solid test templates and examples and/or might have unexpected results. We support adding in these rules so they can be tested, tweaked and improved before they become generally available.

src/cfnlint/config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def __call__(self, parser, namespace, values, option_string=None):
340340
usage = (
341341
"\nBasic: cfn-lint test.yaml\n"
342342
"Ignore a rule: cfn-lint -i E3012 -- test.yaml\n"
343-
"Configure a rule: cfn-lint -x E3012:strict=false -t test.yaml\n"
343+
"Configure a rule: cfn-lint -x E3012:strict=true -t test.yaml\n"
344344
"Lint all yaml files in a folder: cfn-lint dir/**/*.yaml"
345345
)
346346

@@ -465,7 +465,7 @@ def __call__(self, parser, namespace, values, option_string=None):
465465
nargs="+",
466466
default={},
467467
action=RuleConfigurationAction,
468-
help="Provide configuration for a rule. Format RuleId:key=value. Example: E3012:strict=false",
468+
help="Provide configuration for a rule. Format RuleId:key=value. Example: E3012:strict=true",
469469
)
470470
standard.add_argument(
471471
"--config-file",

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ def __init__(self):
2525
super().__init__()
2626
self.resource_specs = []
2727
self.property_specs = []
28-
self.config_definition = {"strict": {"default": False, "type": "boolean"}}
28+
self.config_definition = {
29+
"strict": {"default": False, "type": "boolean"}
30+
} # Strict mode is set to false by default
2931
self.configure()
3032

3133
def initialize(self, cfn):

0 commit comments

Comments
 (0)