-
Notifications
You must be signed in to change notification settings - Fork 623
State Machine: Implement check & Unit Tests for "StartAt" #4264
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
Conversation
|
@kddejong The line length limit is mandatory for cfn-lint code, right? |
kddejong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few checks to validate the types are we hope they are. Happy path says these are the right types but since we are linting we have to assume they could be wrong.
src/cfnlint/rules/resources/stepfunctions/StateMachineDefinition.py
Outdated
Show resolved
Hide resolved
|
I have rebased my branch, implemented your requested changes and also run Can you please trigger the pipeline again? |
a03b3de to
4ca6a1d
Compare
|
@kddejong Thank you, i have rebased the pull request and applied |
|
@kddejong I believe the proposed change - if start_at is None:
+ if not isinstance(start_at, str) and not isinstance(states, dict):caused the updated rule to not work properly and fail the following unittest: unittestThe rule should have ignored the state machine definition since it didn't contain a - if not isinstance(start_at, str) and not isinstance(states, dict):
+ if not isinstance(start_at, str) or not isinstance(states, dict):and locally the state machine unittest, using was passing now. Could you please trigger the GitHub Actions pipeline again? |
|
@kddejong |
|
@kddejong Could you please restart the GitHub Actions pipeline? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4264 +/- ##
==========================================
- Coverage 94.36% 94.35% -0.02%
==========================================
Files 414 414
Lines 13991 14018 +27
Branches 2776 2784 +8
==========================================
+ Hits 13203 13227 +24
- Misses 443 444 +1
- Partials 345 347 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Issue #, if available:
Fixes #4074
Description of changes:
This PR implements a check for
https://states-language.net/spec.html#toplevelfields
Since i am not a professional Python programmer i used the help of a LLM to implement the check and the unit tests, while trying to keep it as simple as possible.
The cfn-lint "Error" messages are almost identical to the State Machine CloudFormation API, but i made it a little bit more human friendly to read.
I tested the following CloudFormation templates, which all displayed the error message in the correct State:
StartAt JSONata / JSONPath
Parallel StartAt JSONata / JSONPath
MapStartAt JSONata / JSONPath
The PR also includes Unit Tests for
which were succesful in local testing.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.