enterprise-contract / ec-cli

Enterprise Contract command line interface
https://enterprisecontract.dev/docs/ec-cli/main/index.html
Apache License 2.0
27 stars 29 forks source link

Add support for JSON and YAML files in --extra-rule-data #1706

Closed yashvardhannanavati closed 3 months ago

yashvardhannanavati commented 3 months ago

This commit adds support for specifying filename as value of a key in --extra-rule-data which can be later used in policy checks.

resolves: CVP-4147

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.

Project coverage is 86.83%. Comparing base (5e58f59) to head (0fa91b0). Report is 3 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1706/graphs/tree.svg?width=650&height=150&src=pr&token=CY5ORXJB33&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract)](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1706?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract) ```diff @@ Coverage Diff @@ ## main #1706 +/- ## ========================================== + Coverage 80.17% 86.83% +6.66% ========================================== Files 67 78 +11 Lines 4858 5204 +346 ========================================== + Hits 3895 4519 +624 + Misses 963 685 -278 ``` | [Flag](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1706/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract) | Coverage Δ | | |---|---|---| | [acceptance](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1706/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract) | `71.94% <70.58%> (?)` | | | [generative](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1706/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract) | `80.27% <100.00%> (+0.09%)` | :arrow_up: | | [integration](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1706/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract) | `80.27% <100.00%> (+0.09%)` | :arrow_up: | | [unit](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1706/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract) | `80.27% <100.00%> (+0.09%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1706?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract) | Coverage Δ | | |---|---|---| | [cmd/validate/image.go](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1706?src=pr&el=tree&filepath=cmd%2Fvalidate%2Fimage.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract#diff-Y21kL3ZhbGlkYXRlL2ltYWdlLmdv) | `95.23% <100.00%> (+1.64%)` | :arrow_up: | | [internal/validate/helpers.go](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1706?src=pr&el=tree&filepath=internal%2Fvalidate%2Fhelpers.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract#diff-aW50ZXJuYWwvdmFsaWRhdGUvaGVscGVycy5nbw==) | `74.07% <70.00%> (ø)` | | ... and [39 files with indirect coverage changes](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1706/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract)
yashvardhannanavati commented 3 months ago

Codecov Report

Attention: Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.

Project coverage is 86.74%. Comparing base (ab24b6a) to head (bf3a66a).

Current head bf3a66a differs from pull request most recent head dadfa45 Please upload reports for the commit dadfa45 to get more accurate results.

Additional details and impacted files

Added another test to cover the missing Error log.

For future reference, there are multiple error log lines that are not covered which are not a part of this PR.

zregvart commented 3 months ago

/ok-to-test

yashvardhannanavati commented 3 months ago

/retest

yashvardhannanavati commented 3 months ago

/retest

yashvardhannanavati commented 3 months ago

/retest