Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance E1011 Message ( is too long) #3782

Open
2 tasks
namireddy opened this issue Oct 21, 2024 · 1 comment · May be fixed by #3798
Open
2 tasks

Enhance E1011 Message ( is too long) #3782

namireddy opened this issue Oct 21, 2024 · 1 comment · May be fixed by #3798

Comments

@namireddy
Copy link

Is this feature request related to a new rule or cfn-lint capabilities?

rules

Describe the feature you'd like to request

Fn::FindInMap, When the nested level depth is greater than 2 , error E1011 is thrown with a message xxx is too long (3).
Sample:
Mappings:
MyCustomMap
Level1:
Level2:
"key":"value"

Error message when cfn-lint is run
E1011 ['MyCustomMap', 'Level1', 'Level2',' Key'] is too long (3)
E3024 ['MyCustomMap', 'Level1', 'Level2', 'Key'] is too long (3)

Describe the solution you'd like

Can the message be improved, to say "FindInMap only supports up to two levels of nesting for map lookups"

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • ⚠️ This feature might incur a breaking change
@kddejong
Copy link
Contributor

kddejong commented Oct 25, 2024

This is the result of the maxItems keyword

def maxItems(
validator: Validator, mI: Any, instance: Any, schema: dict[str, Any]
) -> ValidationResult: # pylint: disable=arguments-renamed
if validator.is_type(instance, "array") and len(instance) > mI:
yield ValidationError(f"{instance!r} is too long ({mI})")

We can alter the wording inside functions or alter the wording for any occurrences of maxItems. The error message from the service would look like expected maximum item count: 3, found: 4. Then we could add a function prefix like Fn::FindInMap expected maximum item count: 3, found: 4

What I like about this is that it removes the instance from the results which can get long.

@kddejong kddejong linked a pull request Oct 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants