opencontrol / compliance-masonry

Security Documentation Builder
Other
348 stars 82 forks source link

Do not fail hard when someone mistypes standard key #375

Closed isimluk closed 3 years ago

isimluk commented 3 years ago

Fail soft instead. Example of failure message:

Component RHEL CoreOS 4 references standard NIST-800-531, however that cannot be found in the workspace

Addressing:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x13f28ee]

goroutine 1 [running]:
github.com/opencontrol/compliance-masonry/validate.validateComponent(0x154d500, 0xc000097c80, 0x154d5c0, 0xc00165c000, 0x0, 0x0, 0x0)
        github.com/opencontrol/compliance-masonry/validate/validate.go:43 +0x22e
github.com/opencontrol/compliance-masonry/validate.Validate()
        github.com/opencontrol/compliance-masonry/validate/validate.go:19 +0x12a
github.com/opencontrol/compliance-masonry/pkg/cli/validate.NewCmdValidate.func1(0xc0001a4b00, 0x17e8c98, 0x0, 0x0)
        github.com/opencontrol/compliance-masonry/pkg/cli/validate/validate.go:16 +0x25
github.com/opencontrol/compliance-masonry/vendor/github.com/spf13/cobra.(*Command).execute(0xc0001a4b00, 0x17e8c98, 0x0, 0x0, 0xc0001a4b00, 0x17e8c98)
        github.com/opencontrol/compliance-masonry/vendor/github.com/spf13/cobra/command.go:854 +0x2c2
github.com/opencontrol/compliance-masonry/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc000021340, 0xc000010010, 0x1541ae0, 0xc000010018)
        github.com/opencontrol/compliance-masonry/vendor/github.com/spf13/cobra/command.go:958 +0x375
github.com/opencontrol/compliance-masonry/vendor/github.com/spf13/cobra.(*Command).Execute(...)
        github.com/opencontrol/compliance-masonry/vendor/github.com/spf13/cobra/command.go:895
github.com/opencontrol/compliance-masonry/pkg/cmd/masonry.Run(0xffffffff, 0xc00008c058)
        github.com/opencontrol/compliance-masonry/pkg/cmd/masonry/masonry.go:14 +0x74
main.main()
        github.com/opencontrol/compliance-masonry/cmd/masonry/masonry.go:14 +0x25

Fixes: #373.

isimluk commented 3 years ago

@carlosmmatos :beers:

codecov[bot] commented 3 years ago

Codecov Report

Merging #375 into master will decrease coverage by 1.97%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #375      +/-   ##
==========================================
- Coverage   77.76%   75.79%   -1.98%     
==========================================
  Files          39       39              
  Lines        1484     1202     -282     
==========================================
- Hits         1154      911     -243     
+ Misses        275      236      -39     
  Partials       55       55              
Impacted Files Coverage Δ
pkg/lib/certifications.go 66.66% <0.00%> (-8.34%) :arrow_down:
...lib/certifications/versions/1_0_0/certification.go 52.94% <0.00%> (-7.93%) :arrow_down:
pkg/cli/export/export_outputFormat.go 60.00% <0.00%> (-4.29%) :arrow_down:
pkg/cli/diff/inventory.go 85.71% <0.00%> (-3.76%) :arrow_down:
pkg/cli/export/export_config.go 69.23% <0.00%> (-2.87%) :arrow_down:
pkg/cli/docs/gitbook/gitbookSummaries.go 88.23% <0.00%> (-2.25%) :arrow_down:
pkg/cli/docs/gitbook/gitbook.go 77.77% <0.00%> (-2.23%) :arrow_down:
pkg/cli/export/exportFormat.go 60.29% <0.00%> (-2.21%) :arrow_down:
pkg/cli/info/info.go 33.33% <0.00%> (-2.09%) :arrow_down:
pkg/cli/export/export_flatten.go 80.88% <0.00%> (-1.90%) :arrow_down:
... and 29 more

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 6713ef0...1cd67e2. Read the comment docs.

isimluk commented 3 years ago

will decrease coverage by 1.97%.

Dear @codecov, your conclusion seems a bit odd.

carlosmmatos commented 3 years ago

so a one-word changed caused a 2% decrease in coverage