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

Show error message when payload is invalid #1425

Merged
merged 4 commits into from
Aug 25, 2024
Merged

Conversation

juli1
Copy link
Contributor

@juli1 juli1 commented Aug 23, 2024

What and why?

  1. We should have only one path passed as parameter
  2. We should show an error if we fail to generate the payload

How?

Ensure we have only one path passed as parameter
Show an error and exit if we cannot generate the payload

@juli1 juli1 added the static-analysis Related to [sarif, sbom] label Aug 23, 2024
@juli1 juli1 requested review from a team as code owners August 23, 2024 01:20
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Aug 23, 2024

Datadog Report

Branch report: juli1/check-payload
Commit report: 637c6dd
Test service: datadog-ci-tests

✅ 0 Failed, 112 Passed, 0 Skipped, 1m 1.77s Total Time

@juli1 juli1 requested a review from Drarig29 August 23, 2024 23:03
Copy link
Contributor

@Drarig29 Drarig29 left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +24 to +28
let fullStr = ''
fullStr += chalk.red(`Cannot generate payload for file ${reportPath}.\n`)
fullStr += chalk.red(`Make sure you run the command inside a git repository and the SBOM file is valid\n`)

return chalk.red(`Cannot generate payload for file ${reportPath}.\n`)
return fullStr
Copy link

Choose a reason for hiding this comment

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

I think you can just do something like

  return chalk.red(
    `Cannot generate payload for file ${reportPath}.\n` +
    `Ensure that you run the command inside a git repository, and that the SBOM file is valid.\n`
  )

Unfortunately GH wont let me make suggestions when there's a deletion 😑

@juli1 juli1 merged commit 1bdf92d into master Aug 25, 2024
18 checks passed
@juli1 juli1 deleted the juli1/check-payload branch August 25, 2024 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
static-analysis Related to [sarif, sbom]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants