Skip to content

Commit

Permalink
Merge branch 'main' into feature/W3037/remove_experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
kddejong authored Dec 16, 2024
2 parents ea0a7bc + f920591 commit 1624912
Show file tree
Hide file tree
Showing 1,258 changed files with 151,652 additions and 249,074 deletions.
5 changes: 5 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage:
status:
project:
default:
threshold: 1%
2 changes: 1 addition & 1 deletion .github/workflows/ci-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Run Tox
run: |
tox -e py -- -m "data or not data"
- uses: codecov/codecov-action@v4
- uses: codecov/codecov-action@v5
if: matrix.os == 'ubuntu-latest'
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
tox -e py
mv coverage.xml coverage-${{ matrix.python }}.xml
- uses: codecov/codecov-action@v4
- uses: codecov/codecov-action@v5
if: matrix.os == 'ubuntu-latest'
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,58 @@
### v1.22.1
## What's Changed
* Add `pattern` for SNS `TopicName` by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3869
* Don't replace `Default` values in `SAM` when SSM parameter by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3874
* Update CloudFormation schemas to `2024-12-12` by @github-actions in https://github.com/aws-cloudformation/cfn-lint/pull/3868
* Dont guess at mappings when values are static in language extension transform by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3875

**Full Changelog**: https://github.com/aws-cloudformation/cfn-lint/compare/v1.22.0...v1.22.1

### v1.22.0
## What's Changed
* Replace parameters when both transforms are used by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3861
* Fix returning `None` from `Fn::FindInMap` by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3866
* Switch back to raising bad path errors by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3862
* Update CloudFormation schemas to `2024-12-10` by @github-actions in https://github.com/aws-cloudformation/cfn-lint/pull/3863

**Full Changelog**: https://github.com/aws-cloudformation/cfn-lint/compare/v1.21.0...v1.22.0

### v1.21.0
## What's Changed
* Pass parameters to `ForEachCollection` processing by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3854
* Update rule [W8003](https://github.com/aws-cloudformation/cfn-python-lint/blob/main/docs/rules.md#W8003) to include always false by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3855
* Skip `Fn::FindInMap` resolution when hitting a `Fn::Sub` by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3856
* Add `Assign` to appropriate state machine options by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3859
* Update CloudFormation schemas to `2024-12-09` by @github-actions in https://github.com/aws-cloudformation/cfn-lint/pull/3853

**Full Changelog**: https://github.com/aws-cloudformation/cfn-lint/compare/v1.20.2...v1.21.0

### v1.20.2
## What's Changed
* Add SES exception for boto `MatchingEventTypes` by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3843
* Allow for major versions for `postgres` by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3850
* Update CloudFormation schemas to `2024-12-02` by @github-actions in https://github.com/aws-cloudformation/cfn-lint/pull/3844

**Full Changelog**: https://github.com/aws-cloudformation/cfn-lint/compare/v1.20.1...v1.20.2

### v1.20.1
## What's Changed
* Update CloudFormation schemas to 2024-11-23 by @github-actions in https://github.com/aws-cloudformation/cfn-lint/pull/3832
* Add `nodejs22.x` to `AWS::Lambda::Function` `Runtime` enum by @JamesKyburz in https://github.com/aws-cloudformation/cfn-lint/pull/3841
* Add `maxItems` for `PathPatternConfig` in `AWS::ElasticLoadBalancingV2::ListenerRule` by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3835

## New Contributors
* @JamesKyburz made their first contribution in https://github.com/aws-cloudformation/cfn-lint/pull/3841

**Full Changelog**: https://github.com/aws-cloudformation/cfn-lint/compare/v1.20.0...v1.20.1

### v1.20.0
## What's Changed
* Update CloudFormation schemas to `2024-11-18` by @github-actions in https://github.com/aws-cloudformation/cfn-lint/pull/3828
* Update error messagings from json schema by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3798
* Create rule [E3695](https://github.com/aws-cloudformation/cfn-python-lint/blob/main/docs/rules.md#E3695) to validate cache cluster engines by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3824

**Full Changelog**: https://github.com/aws-cloudformation/cfn-lint/compare/v1.19.0...v1.20.0

### v1.19.0
## What's Changed
* Update CloudFormation schemas to `2024-11-07` by @github-actions in https://github.com/aws-cloudformation/cfn-lint/pull/3811
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ If you'd like cfn-lint to be run automatically when making changes to files in y
```yaml
repos:
- repo: https://github.com/aws-cloudformation/cfn-lint
rev: v1.19.0 # The version of cfn-lint to use
rev: v1.22.1 # The version of cfn-lint to use
hooks:
- id: cfn-lint
files: path/to/cfn/dir/.*\.(json|yml|yaml)$
Expand All @@ -353,7 +353,7 @@ If you are using a `.cfnlintrc` and specifying the `templates` or `ignore_templa
```yaml
repos:
- repo: https://github.com/aws-cloudformation/cfn-lint
rev: v1.19.0 # The version of cfn-lint to use
rev: v1.22.1 # The version of cfn-lint to use
hooks:
- id: cfn-lint-rc
```
Expand Down
4 changes: 3 additions & 1 deletion docs/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ To include these rules, use the `-e/include-experimental` argument when running
## Rules
(_This documentation is generated by running `cfn-lint --update-documentation`, do not alter this manually_)

The following **237** rules are applied by this linter:
The following **239** rules are applied by this linter:

| Rule ID | Title | Description | Config<br />(Name:Type:Default) | Source | Tags |
| -------- | ----- | ----------- | ---------- | ------ | ---- |
| [E0000<a name="E0000"></a>](../src/cfnlint/rules/errors/parse.py) | Parsing error found when parsing the template | Checks for JSON/YAML formatting errors in your template | | [Source](https://github.com/aws-cloudformation/cfn-lint) | `base` |
| [E0001<a name="E0001"></a>](../src/cfnlint/rules/errors/transform.py) | Error found when transforming the template | Errors found when performing transformation on the template | | [Source](https://github.com/aws-cloudformation/cfn-lint) | `base`,`transform` |
| [E0002<a name="E0002"></a>](../src/cfnlint/rules/errors/rule.py) | Error processing rule on the template | Errors found when processing a rule on the template | | [Source](https://github.com/aws-cloudformation/cfn-lint) | `base`,`rule` |
| [E0003<a name="E0003"></a>](../src/cfnlint/rules/errors/config.py) | Error with cfn-lint configuration | Error as a result of the cfn-lint configuration | | [Source](https://github.com/aws-cloudformation/cfn-lint) | `base`,`rule` |
| [E1001<a name="E1001"></a>](../src/cfnlint/rules/jsonschema/JsonSchema.py) | Basic CloudFormation Template Configuration | Making sure the basic CloudFormation template components are properly configured | sections:string: | [Source](https://github.com/aws-cloudformation/cfn-lint) | `base` |
| [E1002<a name="E1002"></a>](../src/cfnlint/rules/templates/LimitSize.py) | Validate if a template size is too large | Check the size of the template is less than the upper limit | | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html) | `limits` |
| [E1003<a name="E1003"></a>](../src/cfnlint/rules/templates/LimitDescription.py) | Validate the max size of a description | Check if the size of the template description is less than the upper limit | | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html) | `description`,`limits` |
Expand Down Expand Up @@ -204,6 +205,7 @@ The following **237** rules are applied by this linter:
| [E3692<a name="E3692"></a>](../src/cfnlint/rules/resources/rds/DbClusterMultiAz.py) | Validate Multi-AZ DB cluster configuration | When creating a Multi-AZ DB Cluster there are required fields and the allowed values are different | | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-engineversion) | `resources` |
| [E3693<a name="E3693"></a>](../src/cfnlint/rules/resources/rds/DbClusterAurora.py) | Validate Aurora DB cluster configuration | When creating an Aurora DB Cluster there are required fields and the allowed values are different | | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-engineversion) | `resources` |
| [E3694<a name="E3694"></a>](../src/cfnlint/rules/resources/rds/DbClusterInstanceClassEnum.py) | Validates RDS DB Cluster instance class | Validates the RDS DB Cluster instance types based on region and data gathered from the pricing APIs | | [Source]() | `resources` |
| [E3695<a name="E3695"></a>](../src/cfnlint/rules/resources/elasticache/CacheClusterEngine.py) | Validate Elasticache Cluster Engine and Engine Version | Validate the Elasticache cluster engine along with the engine version | | [Source](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/supported-engine-versions.html) | `resources` |
| [E4001<a name="E4001"></a>](../src/cfnlint/rules/metadata/InterfaceConfiguration.py) | Metadata Interface have appropriate properties | Metadata Interface properties are properly configured | | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudformation-interface.html) | `metadata` |
| [E4002<a name="E4002"></a>](../src/cfnlint/rules/metadata/Configuration.py) | Validate the configuration of the Metadata section | Validates that Metadata section is an object and has no null values | | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html) | `metadata` |
| [E5001<a name="E5001"></a>](../src/cfnlint/rules/resources/Modules.py) | Check that Modules resources are valid | Check that Modules resources are valid | | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/) | `resources`,`modules` |
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ classifiers = [
dynamic = ["version", "readme"]
dependencies = [
"pyyaml>5.4",
"aws-sam-translator>=1.91.0",
"aws-sam-translator>=1.94.0",
"jsonpatch",
"networkx>=2.4,<4",
"sympy>=1.0.0",
Expand Down
9 changes: 6 additions & 3 deletions scripts/boto/_automated_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from _types import AllPatches, Patch, ResourcePatches

from cfnlint.schema.resolver import RefResolver
from cfnlint.schema.resolver import RefResolutionError, RefResolver

skip = [
"account",
Expand Down Expand Up @@ -144,7 +144,7 @@ def _nested_objects(
start_path: str,
source: list[str],
):
results = {}
results: dict[str, Patch] = {}
for member, member_data in shape_data.get("members", {}).items():
for p_name, p_data in schema_data.get("properties", {}).items():
if p_name in skip_property_names:
Expand All @@ -162,7 +162,10 @@ def _nested_objects(
if "$ref" not in p_data:
break
path = p_data["$ref"][1:]
p_data = resolver.resolve_from_url(p_data["$ref"])
try:
p_data = resolver.resolve_from_url(p_data["$ref"])
except RefResolutionError:
return results

# skip if we already have an enum or pattern
if any([p_data.get(field) for field in _fields]):
Expand Down
7 changes: 7 additions & 0 deletions scripts/boto/update_schemas_from_boto.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
"batch",
]

exceptions = {
"ses": ["/definitions/EventDestination/properties/MatchingEventTypes/items"]
}


def configure_logging():
"""Setup Logging"""
Expand Down Expand Up @@ -88,6 +92,9 @@ def build_resource_type_patches(
)
continue
if value:
if patch.source[0] in exceptions:
if path in exceptions[patch.source[0]]:
continue
if patch.source[0] in case_insensitive_services and field == "enum":
field = "enumCaseInsensitive"
value = [v.lower() for v in value]
Expand Down
7 changes: 6 additions & 1 deletion scripts/update_schemas_from_aws_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ def write_db_instance(results):
continue

engine_versions = sorted(results.get(engine))
if engine == "postgres":
for engine_version in engine_versions.copy():
major_engine_version = ".".join(engine_version.split(".")[0:1])
if major_engine_version not in engine_versions:
engine_versions.append(major_engine_version)
engine_versions = sorted(engine_versions)
if engine == "aurora-mysql":
for engine_version in engine_versions.copy():
sub_engine_version = ".".join(engine_version.split(".")[0:2])
Expand Down Expand Up @@ -258,7 +264,6 @@ def elasticache_api():
for page in elasticache_client.get_paginator(
"describe_cache_engine_versions"
).paginate():
print(page)
for version in page.get("CacheEngineVersions"):
engine = version.get("Engine")
engine_version = version.get("EngineVersion")
Expand Down
8 changes: 4 additions & 4 deletions src/cfnlint/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,10 +796,10 @@ def _glob_filenames(self, filenames: Sequence[str]) -> list[str]:
for filename in filenames:
add_filenames = glob.glob(filename, recursive=True)

if isinstance(add_filenames, list):
all_filenames.extend(add_filenames)
else:
LOGGER.error(f"{filename} could not be processed by glob.glob")
if not add_filenames and not self.ignore_bad_template:
raise ValueError(f"{filename} could not be processed by glob.glob")

all_filenames.extend(add_filenames)

return sorted(list(map(str, map(Path, all_filenames))))

Expand Down
8 changes: 6 additions & 2 deletions src/cfnlint/context/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ class Context:

# is the value a resolved value
is_resolved_value: bool = field(init=True, default=False)
resolve_pseudo_parameters: bool = field(init=True, default=True)

def evolve(self, **kwargs) -> "Context":
"""
Expand All @@ -180,8 +181,11 @@ def evolve(self, **kwargs) -> "Context":
return cls(**kwargs)

def ref_value(self, instance: str) -> Iterator[Tuple[str | list[str], "Context"]]:
if instance in PSEUDOPARAMS and instance not in self.pseudo_parameters:
return
if instance in PSEUDOPARAMS:
if not self.resolve_pseudo_parameters:
return
if instance not in self.pseudo_parameters:
return

if instance in self.ref_values:
yield self.ref_values[instance], self
Expand Down
Loading

0 comments on commit 1624912

Please sign in to comment.