Skip to content

Conversation

@eranturgeman
Copy link
Contributor

@eranturgeman eranturgeman commented Sep 3, 2024

  • The pull request is targeting the dev branch.
  • The code has been validated to compile successfully by running go vet ./....
  • The code has been formatted properly using go fmt ./....
  • All static analysis checks passed.
  • All tests have passed. If this feature is not already covered by the tests, new tests have been added.
  • All changes are detailed at the description. if not already covered at JFrog Documentation, new documentation have been added.

The 'jf scan' command should be executed in the following manner: jf scan [command options] OR jf scan [command options] --spec=.
If the command was written in a different order: jf scan [command options], it may lead that some flags are mistaken as arguments and are not going through the command's flags verifications. Therefore, if a wrong flag was provided in this manner - it will get skipped completely without informing the customer.
I added a warning to indicate the wrong usage and what it may cause.
The indication comes in a Warning form and not error in order to not breaking customers.

…with arguments that have been provided in an incorrect order
@eranturgeman eranturgeman added ignore for release Automatically generated release notes safe to test Approve running integration tests on a pull request labels Sep 3, 2024
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Sep 3, 2024
@eranturgeman eranturgeman added the safe to test Approve running integration tests on a pull request label Sep 3, 2024
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Sep 3, 2024
Copy link
Contributor

@attiasas attiasas left a comment

Choose a reason for hiding this comment

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

Nice, take a look at my comments

@eranturgeman eranturgeman added the safe to test Approve running integration tests on a pull request label Sep 5, 2024
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Sep 5, 2024
@hadarshjfrog
Copy link
Contributor

Please add integration tests you think might simulate it - with the common mistakes we have seen (flags at the end instead of beginning, watch/license instead of watches/licenses

@eranturgeman eranturgeman changed the title Add a warning to indicate wrong usage in 'jf scan' command Fail 'jf scan' when a wrong flag is provided after command's arguments Sep 5, 2024
@eranturgeman eranturgeman added bug Something isn't working safe to test Approve running integration tests on a pull request and removed ignore for release Automatically generated release notes labels Nov 11, 2024
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Nov 11, 2024
@github-actions
Copy link

👍 Frogbot scanned this pull request and did not find any new security issues.


@github-actions
Copy link

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/jfrog/jfrog-cli-security 0.00% (ø)
github.com/jfrog/jfrog-cli-security/cli 0.00% (ø)
github.com/jfrog/jfrog-cli-security/utils 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/jfrog/jfrog-cli-security/cli/scancommands.go 0.00% (ø) 0 0 0
github.com/jfrog/jfrog-cli-security/utils/utils.go 0.00% (ø) 0 0 0

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/jfrog/jfrog-cli-security/scans_test.go

…o fix-scan-ignored-flags-issue

# Conflicts:
#	scans_test.go
#	utils/utils.go
@eranturgeman eranturgeman added the safe to test Approve running integration tests on a pull request label May 4, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label May 4, 2025
Copy link
Contributor

@attiasas attiasas left a comment

Choose a reason for hiding this comment

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

LGTM, make sure the PR description is formated


callback := commonTests.MockProgressInitialization()
defer callback()
integration.InitScanTest(t, scangraph.GraphScanMinXrayVersion)
Copy link
Contributor

@attiasas attiasas May 7, 2025

Choose a reason for hiding this comment

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

integration.InitScanTest should be the first line, skipping the test if needed

Comment on lines +111 to +112
err := securityTests.PlatformCli.Exec(args...)
assert.Error(t, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
err := securityTests.PlatformCli.Exec(args...)
assert.Error(t, err)
assert.Error(t, securityTests.PlatformCli.Exec(args...))

maybe you can also check if its the error you added (or error expected) and not random one

Comment on lines +106 to +108
args = []string{"scan", "--watch=my-watch", binariesPath}
} else {
args = []string{"scan", binariesPath, "--watch=my-watch"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
args = []string{"scan", "--watch=my-watch", binariesPath}
} else {
args = []string{"scan", binariesPath, "--watch=my-watch"}
args = []string{"scan", "--not-defined-flag=value", binariesPath}
} else {
args = []string{"scan", binariesPath, "--watches=my-watch"}

change the flag name to make it more readable

@attiasas attiasas closed this Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants