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

separate sleuth command for 'oss index' #165

Merged
merged 6 commits into from
Aug 18, 2020
Merged

separate sleuth command for 'oss index' #165

merged 6 commits into from
Aug 18, 2020

Conversation

bhamail
Copy link
Contributor

@bhamail bhamail commented Aug 13, 2020

This PR creates a new sub command named sleuth for running nancy against OSS Index.

There is more work to do regarding updating cmd examples and README.md, but I wanted to put this out there to get initial reactions.

cc @bhamail / @DarthHater

@DarthHater
Copy link
Member

I am pro this, overall. It certainly makes the code a lot cleaner and easier to follow (I think), so feel free to keep moving on it.

cmd/iq_test.go Outdated
Comment on lines 56 to 57
// not sure why calling executeCommand() fails as part of test suite, but is fine individually.
//_, err := executeCommand(rootCmd, iqCmd.Use, "--path", "invalidPath", "-a", "appId")
Copy link
Contributor

Choose a reason for hiding this comment

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

So these are a fix it later thing??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So these are a fix it later thing??

Yes, or at least an "understand it better later" thing. Added TODO comments. cbcbbe3

I'm pretty sure this is an example of the dangers of using shared state - meaning the configOssi is essentially global, and testing gets wonky quickly because of the side effects of manipulating configOssi. Combine that with some of the essentially global state of Cobra/Viper initialization, and complexity abounds.

I would prefer these tests to work using executeCommand() because that would verify more of the Cobra stuff, but I spent enough time trying to figure out why the executeCommand() flavor works when run alone, but causes failures when run in a test suite with other tests.

cmd/iq_test.go Outdated
Comment on lines 70 to 71
// not sure why calling executeCommand() fails as part of test suite, but is fine individually.
//_, err := executeCommand(rootCmd, iqCmd.Use, "--path", GopkgLockFilename, "-a", "appId")
Copy link
Contributor

Choose a reason for hiding this comment

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

So these are a fix it later thing??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So these are a fix it later thing??

Yes, or at least an "understand it better later" thing. Added TODO comments. cbcbbe3

@bhamail
Copy link
Contributor Author

bhamail commented Aug 18, 2020

If no objections, I'll merge this puppy, now that the build is passing.

@bhamail bhamail merged commit 0fdbaab into prepare-1.0.0 Aug 18, 2020
bhamail added a commit that referenced this pull request Aug 27, 2020
…ial release (#161)

* Cobra/Viper CLI. 
* Goodbye go.sum old friend
  You were fine to start but newer better things came along. We will never forget your
  contributions to the cause.
* fix missing -p flag, document --loud flag
* Make some packages internal (#163)
* remove types that migrated to go-sona-types library (#164)
* store config using nested yaml (ossi.yadda, iq.yadda).
* separate `sleuth` command for 'oss index' (#165)
  new sub command named `sleuth` for running nancy against OSS Index.
* make `--clean-cache` available as root command, since it is not specific to ossi or iq. (#169)
* Latest dependencies, remove obsolete 'replace' directives (#173)
* Use goreleaser to build native linux installers (#175)

Co-authored-by: Nathan Zender <github@nathanzender.com>
Co-authored-by: Jeffry Hesse <5544326+DarthHater@users.noreply.github.com>
zendern added a commit to zendern/nancy that referenced this pull request Apr 16, 2021
…ial release (sonatype-nexus-community#161)

* Cobra/Viper CLI. 
* Goodbye go.sum old friend
  You were fine to start but newer better things came along. We will never forget your
  contributions to the cause.
* fix missing -p flag, document --loud flag
* Make some packages internal (sonatype-nexus-community#163)
* remove types that migrated to go-sona-types library (sonatype-nexus-community#164)
* store config using nested yaml (ossi.yadda, iq.yadda).
* separate `sleuth` command for 'oss index' (sonatype-nexus-community#165)
  new sub command named `sleuth` for running nancy against OSS Index.
* make `--clean-cache` available as root command, since it is not specific to ossi or iq. (sonatype-nexus-community#169)
* Latest dependencies, remove obsolete 'replace' directives (sonatype-nexus-community#173)
* Use goreleaser to build native linux installers (sonatype-nexus-community#175)

Co-authored-by: Nathan Zender <github@nathanzender.com>
Co-authored-by: Jeffry Hesse <5544326+DarthHater@users.noreply.github.com>
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.

3 participants