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

Refactor opencontrol interface and clean common part 1. #217

Merged
merged 13 commits into from
Oct 3, 2016

Conversation

jcscottiii
Copy link
Member

@jcscottiii jcscottiii commented Aug 22, 2016

Builds on #216

This was necessary to clean up lib/common package.

The lib/common package had both interfaces and structs for the YAMLs.
This led to weird import paths to get around circular dependencies.
This patch is just mostly moving stuff around.

  • Renamed Entry to RemoteSource in the lib/common package
    • It was very vague what an Entry was. It really was a container of information to some remote (re)source
    • RemoteSource is now an interface, instead of a struct of yaml details
  • The implementation of RemoteSource for the v1.0.0 of the OpenControl is now called VCSEntry (Probably should be called VCSSource)
    • The implementation of Entry / VCSEntry (with the yaml tags) for v1.0.0 was in the lib/common package. Not where things should be for implementation. Hence, it has moved to lib/opencontrol/versions/1.0.0/opencontrol.go
  • EntryDownloader was renamed to Downloader
    • This was due to two facts:
      1. Too long of a name
      2. Entry no longer exists due to the last point.
  • Clean up functionality between the lib/opencontrol and commands/get.
    • Prior to this patch, functionality used by the command/get was in the lib package. (GetResources, GetRemoteResources, GetLocalResources). This made it very hard to separate out lib/common
    • This logic has been moved to the commands/get/resources package
  • Removed the lib/opencontrol/versions/base package
  • Moved the interface OpenControl from lib/opencontrol/versions/base/ to lib/common
    • Also, changed the interface methods from Parse, GetSchemaVersion and GetResources to GetCertifications GetStandards GetComponents GetCertificationsDependencies GetStandardsDependencies GetComponentsDependencies
    • This conforms with the other three yaml interfaces in which the interface returns information about the schema and not actions the schema should be doing. This makes it easier to separate between lib and command (which is also nice for plugins)
  • Removed Worker struct. It created a circular dependency when trying to use with mocks.

@codecov-io
Copy link

codecov-io commented Aug 22, 2016

Current coverage is 92.03% (diff: 94.32%)

Merging #217 into add-result-package will increase coverage by 0.29%

@@           add-result-package       #217   diff @@
====================================================
  Files                      32         30     -2   
  Lines                     968        979    +11   
  Methods                     0          0          
  Messages                    0          0          
  Branches                    0          0          
====================================================
+ Hits                      888        901    +13   
+ Misses                     65         64     -1   
+ Partials                   15         14     -1   

Powered by Codecov. Last update f898b26...9cbd029

@jcscottiii jcscottiii changed the title Move opencontrol interface Refactor opencontrol interface and clean common part 1. Aug 22, 2016
@jcscottiii jcscottiii force-pushed the move-opencontrol-interface branch 2 times, most recently from 419e4cb to ecd0580 Compare August 22, 2016 21:22
})


var _ = Describe("Entry", func() {
Copy link
Member Author

Choose a reason for hiding this comment

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

VCSEntry

Copy link
Member

Choose a reason for hiding this comment

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

/me is assuming that's a TODO for yourself...?

Copy link
Member Author

Choose a reason for hiding this comment

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

^yep!

@afeld afeld changed the base branch from master to add-result-package August 23, 2016 16:12
table.DescribeTable("DownloadRepo", func(err error) {
remoteSource := new(commonMocks.RemoteSource)
remoteSource.On("GetURL").Return("")
remoteSource.On("GetRevision").Return("")
Copy link
Member

Choose a reason for hiding this comment

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

Why would these be empty?

Copy link
Member Author

Choose a reason for hiding this comment

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

these don't matter as much since it's not actually downloading something. but i can put something here so people know what to expect!

@afeld
Copy link
Member

afeld commented Aug 23, 2016

Phew, ok, a handful of notes. Let's please please please try and keep the pull requests smaller for reviewer sanity 😁

@jcscottiii
Copy link
Member Author

@afeld this should be ready!

James C. Scott added 5 commits October 3, 2016 14:50
@afeld afeld changed the base branch from add-result-package to master October 3, 2016 21:20
"github.com/opencontrol/compliance-masonry/tools/mapset"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
Copy link
Member

Choose a reason for hiding this comment

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

This many imports seems like a red flag that the setup for these structs/functions are too complicated, though I don't have specific suggestions about how to simplify 😕

@afeld afeld merged commit 6513ee2 into master Oct 3, 2016
@jcscottiii jcscottiii deleted the move-opencontrol-interface branch October 4, 2016 18:43
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