8000 Fix Yaml Validation for when testParameterFiles is empty or non-existent by fhembroff · Pull Request #233 · dockstore/dockstore-cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix Yaml Validation for when testParameterFiles is empty or non-existent #233

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

Merged
merged 12 commits into from
Apr 3, 2023

Conversation

fhembroff
Copy link
Contributor
@fhembroff fhembroff commented Mar 27, 2023

Description
This PR makes it such that you can have a .dockstore.yml file that has either an empty or non-existent testParameterFiles field. This is valid and accepted by dockstore.org, but it wasn't accepted by the dockstore yaml validator (until now).

Whilst completing this PR I also realized DockstoreYamlHelper.validateDockstoreYamlProperties() did not throw an error when

  • a .dockstore.yml file contained no primaryDescriptorPath
  • a service contained no files

The former was already fixed, but for the ladder was not, hence why I added this code. I have created this ticket to improve DockstoreYamlHelper.validateDockstoreYamlProperties() and left instructions to remove the fixes in the CLI for the above two errors when the issue is resolved (as they should be caught by DockstoreYamlHelper.validateDockstoreYamlProperties()).

Review Instructions
Ensure that a .dockstore.yml file with either an empty or non-existent testParameterFiles field (but with everything else correct) passes the dockstore yaml validator with no errors. As it is valid to have a .dockstore.yml file with either an empty or non-existent testParameterFiles field.

Issue
dockstore/dockstore#5401
DOCK-2338

Security
If there are any concerns that require extra attention from the security team, highlight them here.

Please make sure that you've checked the following before submitting your pull request. Thanks!

  • Check that you pass the basic style checks and unit tests by running ./mvnw clean install
  • If this PR is for a user-facing feature, create and link a documentation ticket for this feature (usually in the same milestone as the linked issue). Style points if you create a documentation PR directly and link that instead.

…scriptor field is not provided, or is empty, an error will be thrown by readAsDockstoreYaml12
One where the testParameterFiles filed is empty and one where the testParameterFiles field DOES NOT EXIST
@fhembroff fhembroff self-assigned this Mar 27, 2023
@fhembroff fhembroff changed the title Feature/dock 2338/yaml missing file error Fix Yaml Validation for when testParameterFiles is empty or non-existent Mar 27, 2023
@codecov
Copy link
codecov bot commented Mar 27, 2023

Codecov Report

Patch coverage: 93.33% and project coverage change: -2.15 ⚠️

Comparison is base (ca43df5) 69.48% compared to head (0d9b54f) 67.33%.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #233      +/-   ##
=============================================
- Coverage      69.48%   67.33%   -2.15%     
+ Complexity      1042     1005      -37     
=============================================
  Files             47       47              
  Lines           6072     6077       +5     
  Branches         801      802       +1     
=============================================
- Hits            4219     4092     -127     
- Misses          1514     1646     +132     
  Partials         339      339              
Flag Coverage Δ
bitbuckettests 9.87% <0.00%> (-0.01%) ⬇️
confidentialtooltests 54.73% <93.33%> (+0.31%) ⬆️
confidentialworkflowtests 28.07% <93.33%> (+0.42%) ⬆️
nonconfidentialtests 32.41% <0.00%> (-0.02%) ⬇️
singularitytests 16.60% <0.00%> (-0.02%) ⬇️
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ava/io/dockstore/client/cli/YamlVerifyUtility.java 72.28% <93.33%> (-20.02%) ⬇️

... and 13 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

< 8000 p dir="auto">☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@fhembroff fhembroff marked this pull request as ready for review March 27, 2023 21:25
@denis-yuen denis-yuen requested a review from svonworl March 28, 2023 14:38
Copy link
Member
@denis-yuen denis-yuen left a comment

Choose a reason for hiding this comment

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

A couple minor questions/nitpicks, approach in general seems ok

description: testing testing testing
data:
test-2:
targetDirectory: ~/test
Copy link
Member

Choose a reason for hiding this comment

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

How are these ~ interpreted? Were these examples from somewhere else?

Copy link
Contributor Author
@fhembroff fhembroff Mar 28, 2023

Choose a reason for hiding this comment

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

This would've just been me filling out the template. I just copied a .dockstore.yml file I had already created for this file.

However, after reading through the template, it appears this is not valid, as it requires that the targetDirectory is a relative path.

I have corrected this for all .dockstore.yml test files that I created.

I have also added this comment to this ticket to either correct DockstoreYamlHelper.validateDockstoreYamlProperties() such that it catches this in the future, or to update the template to indicate that absolute paths are acceptable.

@fhembroff fhembroff requested a review from denis-yuen March 28, 2023 15:20
filePathsToCheck.addAll(testParameterFiles);
}

filePathsToCheck.add(tool.getPrimaryDescriptorPath());
Copy link
Contributor

Choose a reason for hiding this comment

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

It was like this, but this whole code block duplicates code block starting at line 95. You could optionally refactor a couple of ways to avoid the duplication.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactored it a bit.

Thanks for the feedback.

}

missingFiles.addAll(filesExist(filePathsToCheck, basePath));
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment is for line 122/139, and it was like this, but INVALID_FILE_STRUCTURE, which translates to Your file structure has the following errors: -- I would say something like Your .dockstore.yml has the following errors: -- INVALID_FILE_STRUCTURE is slightly misleading variable name too (the structure of the file is fine in this case, it's just values that aren't good).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed INVALID_FILE_STRUCTURE to MISSING_FILE_ERROR. I also changed the wording to "Your .dockstore.yml has the following errors:".

Thanks!

@sonarqubecloud
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 1 Code Smell

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@fhembroff fhembroff merged commit 2988b0b into develop Apr 3, 2023
@fhembroff fhembroff deleted the feature/DOCK-2338/yaml-missing-file-error branch April 3, 2023 14:30
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 this pull request may close these issues.

5 participants
0