-
Notifications
You must be signed in to change notification settings - Fork 69
refactor(toolkit-lib): diff action uses helper methods #301
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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #301 +/- ##
==========================================
- Coverage 86.98% 86.92% -0.06%
==========================================
Files 220 220
Lines 35611 35634 +23
Branches 4351 4364 +13
==========================================
Hits 30975 30975
- Misses 4540 4564 +24
+ Partials 96 95 -1
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:
|
| const formatter = new DiffFormatter({ | ||
| ioHelper, | ||
| oldTemplate: template, | ||
| newTemplate: stacks.firstStack, | ||
| oldTemplate: template.oldTemplate, | ||
| newTemplate: template.newTemplate, | ||
| }); |
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.
Seems okay, but could DiffFormatter not just take the instance of template here and subsequent calls to formatSecurityDiff and formatStackDiff would not need to the other options.
Or the other way around: template is passed as is into formatSecurityDiff and formatStackDiff
Just seems odd to split up the input.
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.
this is a great idea, simplifies a whole bunch actually
|
|
||
| if (diffMethod.method === 'local-file') { | ||
| const methodOptions = diffMethod.options as LocalFileDiffOptions; | ||
| const templateInfos = await makeTemplateInfos(ioHelper, stacks, deployments, await this.sdkProvider('diff'), options); |
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.
So this is preparing the diff? Current names read unclear to me. Maybe something like this is clearer:
| const templateInfos = await makeTemplateInfos(ioHelper, stacks, deployments, await this.sdkProvider('diff'), options); | |
| const diffInput = await prepareDiff(ioHelper, stacks, deployments, await this.sdkProvider('diff'), options); |
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.
i like the prepareDiff name but also after my latest refactor i think the type of TemplateInfo now makes more sense -- since its only getting passed into DiffFormatter. lemme know if you disagree
Signed-off-by: github-actions <[email protected]>
Signed-off-by: github-actions <[email protected]>
refactors the diff action to use helper methods and in general cleans up the code a lot. introduces an internal concept of `TemplateInfo` that standardizes the to-be-diffed information, so there's not a bunch of repetitive code existing tests continue to succeed. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license --------- Signed-off-by: github-actions <[email protected]> Co-authored-by: github-actions <[email protected]>
`Notices` will eventually serve both toolkit-lib and cli. Currently the class has a hard-coded "cli version" - but really the value is reading the version from whatever the current package is. Once we start using this file in another package, it will be wrong. For now, let's just remove the hard dependency on cli version inside the class. In future it will be extended. - Remove direct dependency on versionNumber import in Notices class - Add cliVersion as a required parameter in NoticesProps interface - Store cliVersion as a class property and use it in display method - Improve testability by removing the need to mock version functions --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
The message payload interfaces never were an api. They just ended up there by chance. Move them to their own top-level module. This has the side-effect that it will make future diffs slightly nicer. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
We are about to move this module into a different package, and the target package is gitignoring any directory called `logs`. We could just fix the gitignore, but the module name is very inacurate anyway. Therefore we are renaming it. Also moves `rwlock` from `api/utils` to `api`. This was an oversight and doesn't warrant a separate PR. Finally moves some test files into their correct corresponding directories. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
Once this is merged we can increase concurrency. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
Fixes #448 Prior to #301 we were using both `stackName` and `displayName` interchangably in different areas of the CLI. #301 chose to standardize to `stackName`. This PR changes that to `displayName`. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license --------- Signed-off-by: github-actions <[email protected]> Co-authored-by: Momo Kornher <[email protected]> Co-authored-by: github-actions <[email protected]>
refactors the diff action to use helper methods and in general cleans up the code a lot. introduces an internal concept of
TemplateInfothat standardizes the to-be-diffed information, so there's not a bunch of repetitive codeexisting tests continue to succeed.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license