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

Added rational sort order for Justifications, Verifications, and Components #334

Merged
merged 1 commit into from
Dec 20, 2018

Conversation

riskpeep
Copy link

Added natural sort for justifications and verifications.
Added sort by key for components

Provides rational sort order for generated gitbook documents.

@codecov
Copy link

codecov bot commented Nov 15, 2018

Codecov Report

Merging #334 into master will decrease coverage by 0.16%.
The diff coverage is 55.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #334      +/-   ##
==========================================
- Coverage   79.06%   78.89%   -0.17%     
==========================================
  Files          38       38              
  Lines        1428     1436       +8     
==========================================
+ Hits         1129     1133       +4     
- Misses        246      250       +4     
  Partials       53       53
Impacted Files Coverage Δ
pkg/lib/result/justifications.go 75.86% <100%> (+0.86%) ⬆️
pkg/lib/common/verifications.go 66.66% <100%> (ø) ⬆️
pkg/lib/components.go 87.5% <42.85%> (-7.63%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b3f60cb...71009b3. Read the comment docs.

@codecov
Copy link

codecov bot commented Nov 15, 2018

Codecov Report

Merging #334 into master will increase coverage by 0.11%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #334      +/-   ##
==========================================
+ Coverage   79.06%   79.17%   +0.11%     
==========================================
  Files          38       38              
  Lines        1428     1436       +8     
==========================================
+ Hits         1129     1137       +8     
  Misses        246      246              
  Partials       53       53
Impacted Files Coverage Δ
pkg/lib/common/verifications.go 66.66% <100%> (ø) ⬆️
pkg/lib/result/justifications.go 75.86% <100%> (+0.86%) ⬆️
pkg/lib/components.go 95.83% <100%> (+0.71%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1891cff...c3a7f6b. Read the comment docs.

@shawndwells
Copy link
Member

@riskpeep Thanks for this! Just fixed some of the appveyor issues through #335. Could you rebase, which will (re)test this PR?

@riskpeep
Copy link
Author

When considering the pull request, pay some attention to the edits to parse_test 8d2805e

I had to make those edits to get the appveyor build to pass. The same tests passed w/o those edits on my Linux dev box and none of the other edits for this PR should have impacted the code in parse.go, so I'm not 100% sure why appveyor complained and my local 'make test' did not.

Added sort by key for components
Added tests for verifications and justifications
Removed declared but unused openControl var in parse_test.go so tests pass
Added TestGetAllComponent to increase code coverage
@redhatrises
Copy link
Collaborator

@riskpeep sorry for late reply on this... Code looks good and tests are passing.

@shawndwells can you build some opencontrol content with this PR and see if anything breaks at the content layer?

@shawndwells
Copy link
Member

$ git checkout -b riskpeep-dev-sort-order master
Switched to a new branch 'riskpeep-dev-sort-order'

$ git pull https://github.com/riskpeep/compliance-masonry.git dev-sort-order
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 14 (delta 10), reused 14 (delta 10), pack-reused 0
Unpacking objects: 100% (14/14), done.
From https://github.com/riskpeep/compliance-masonry
 * branch            dev-sort-order -> FETCH_HEAD
Updating 1891cff..c3a7f6b
Fast-forward
 pkg/lib/common/verifications.go       |  6 +++++-
 pkg/lib/common/verifications_test.go  |  4 +++-
 pkg/lib/components.go                 | 15 +++++++++++++++
 pkg/lib/components_test.go            | 19 +++++++++++++++++++
 pkg/lib/opencontrol/parse_test.go     | 18 +++++++++---------
 pkg/lib/result/justifications.go      |  2 ++
 pkg/lib/result/justifications_test.go | 27 +++++++++++++++++++++++++++
 7 files changed, 80 insertions(+), 11 deletions(-)

$ make
go build -gcflags="-N -l" -ldflags="-s -w -X github.com/opencontrol/compliance-masonry/version.Version=1.1.5 -X github.com/opencontrol/compliance-masonry/version.Commit=c3a7f6b -X github.com/opencontrol/compliance-masonry/version.Date=2018-12-10T22:31:53+0000"\
		-o _output/masonry \
		cmd/masonry/masonry.go
go build -gcflags="-N -l" -ldflags="-s -w -X github.com/opencontrol/compliance-masonry/version.Version=1.1.5 -X github.com/opencontrol/compliance-masonry/version.Commit=c3a7f6b -X github.com/opencontrol/compliance-masonry/version.Date=2018-12-10T22:31:53+0000"\
                -o _output/compliance-masonry \
                cmd/compliance-masonry/compliance-masonry.go

for testing, using the following opencontrol.yaml:

$ cat opencontrol.yaml
schema_version: "1.0.0"
name: Template Information System
metadata:
  description: Template Information System
  maintainers:
    - Shawn Wells <shawn@redhat.com>

components:
#    - ./../../ComplianceAsCode/redhat-openstack-platform-13
#    - ./../../ComplianceAsCode/redhat-openshift-v3
#    - ./../../ComplianceAsCode/redhat/ansible-tower

dependencies:
  standards:
    - url: https://github.com/opencontrol/standards
      revision: master
  certifications:
    - url: https://github.com/opencontrol/certifications
      revision: master
  systems:
#    - url: https://github.com/SecurityCentral/template-system-process-controls
#      revision: opencontrol
    - url: https://github.com/ComplianceAsCode/redhat
      contextdir: osp13
      revision: opencontrol
    - url: https://github.com/ComplianceAsCode/redhat
      contextdir: ocp3
      revision: opencontrol
    - url: https://github.com/ComplianceAsCode/redhat
      contextdir: idm
      revision: opencontrol
    - url: https://github.com/ComplianceAsCode/redhat
      contextdir: ansible-tower
      revision: opencontrol
    - url: https://github.com/ComplianceAsCode/redhat
      contextdir: rhvm
      revision: opencontrol
    - url: https://github.com/ComplianceAsCode/redhat
      contextdir: rhvh
      revision: opencontrol

and attempting a fetch/get:

$ /Users/shawnwells/Documents/github/opencontrol/compliance-masonry/_output/compliance-masonry get
An error occurred: readdirent: invalid argument

@shawndwells
Copy link
Member

@riskpeep @redhatrises looks like masonry has errors, but may reflect something from upstream vs this patch

@shawndwells
Copy link
Member

this is on OSX with golang 1.10.1

@redhatrises
Copy link
Collaborator

@riskpeep @redhatrises looks like masonry has errors, but may reflect something from upstream vs this patch

@shawndwells I am not seeing the error that you are getting. I wonder if it is an issue with golang 1.10.1? Seems to work for me.

@shawndwells
Copy link
Member

upgraded golang to 1.11.4 and this works now

@shawndwells shawndwells merged commit f561e7b into opencontrol:master Dec 20, 2018
@shawndwells
Copy link
Member

thanks, @riskpeep!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants