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

Add checking the uss file path when upload file or stdin to uss file. #145

Merged
merged 3 commits into from
Nov 17, 2023

Conversation

tiantn
Copy link
Collaborator

@tiantn tiantn commented Nov 10, 2023

What It Does

How to Test

Review Checklist
I certify that I have:

Additional Comments

fix #144

@tiantn tiantn requested review from std4lqi and zFernand0 November 10, 2023 07:11
@codecov-commenter
Copy link

codecov-commenter commented Nov 10, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (0dbd9a4) 72.39% compared to head (c230fe2) 73.04%.
Report is 16 commits behind head on master.

Files Patch % Lines
src/cli/Utilities.ts 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #145      +/-   ##
==========================================
+ Coverage   72.39%   73.04%   +0.64%     
==========================================
  Files          79       80       +1     
  Lines         960      983      +23     
  Branches      125      130       +5     
==========================================
+ Hits          695      718      +23     
  Misses        244      244              
  Partials       21       21              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

params.response.data.setMessage(successMsg);
this.log.info(successMsg);

if (!ussFile.startsWith('/')) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to have this check in UssUtils.checkAbsoluteFilePath(filePath), which returns error message when the check fails. In this way, we can avoid having the check and error message duplicate in two places.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @std4lqi ! I add checkAbsoluteFilePath in UssUtils and add test in UssUtils.test.ts.

Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@tiantn tiantn requested a review from std4lqi November 14, 2023 06:24
@std4lqi
Copy link
Collaborator

std4lqi commented Nov 14, 2023

Thanks, @tiantn !

Copy link
Member

@zFernand0 zFernand0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 😋

if (!filePath.startsWith('/')) {
throw new ImperativeError({ msg: "Please check the uss file path. The full file path is required."});
} else {
return filePath;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the current usage of the function, I don't think we need to return the filePath, but it doesn't hurt (in case we want to use it in the near future)

No changes requested here 😋

@zFernand0 zFernand0 merged commit 036f450 into master Nov 17, 2023
18 checks passed
@zFernand0 zFernand0 deleted the check-ussfile branch November 17, 2023 20:06
@zFernand0 zFernand0 added the release-patch Indicates a patch to existing code has been applied label Nov 17, 2023
Copy link

Release succeeded for the master branch. 🎉

The following packages have been published:

Powered by Octorelease 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-patch Indicates a patch to existing code has been applied released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

upload file-to-uss-file tries to create a dataset
4 participants