MCPcopy Create free account
hub / github.com/conforma/cli / NewReport

Function NewReport

internal/input/report.go:101–126  ·  view source on GitHub ↗

WriteReport returns a new instance of Report representing the state of the filepaths provided.

(inputs []Input, policy policy.Policy, policyInput [][]byte, showSuccesses bool, showWarnings bool, showPolicyDocsLink bool)

Source from the content-addressed store, hash-verified

99// WriteReport returns a new instance of Report representing the state of
100// the filepaths provided.
101func NewReport(inputs []Input, policy policy.Policy, policyInput [][]byte, showSuccesses bool, showWarnings bool, showPolicyDocsLink bool) (Report, error) {
102 success := true
103
104 // Set the report success, remains true if all the files were successfully validated
105 for _, fpath := range inputs {
106 if !fpath.Success {
107 success = false
108 break
109 }
110 }
111
112 info, _ := version.ComputeInfo()
113
114 return Report{
115 Success: success,
116 created: time.Now().UTC(),
117 FilePaths: inputs,
118 Policy: policy.Spec(),
119 EcVersion: info.Version,
120 EffectiveTime: policy.EffectiveTime().UTC(),
121 PolicyInput: policyInput,
122 ShowSuccesses: showSuccesses,
123 ShowWarnings: showWarnings,
124 ShowPolicyDocsLink: showPolicyDocsLink,
125 }, nil
126}
127
128// WriteAll writes the report to all the given targets.
129func (r Report) WriteAll(targets []string, p format.TargetParser) (allErrors error) {

Callers 7

validateInputCmdFunction · 0.92
Test_ReportJsonFunction · 0.70
Test_ReportYamlFunction · 0.70
Test_ReportSummaryFunction · 0.70
Test_ReportTextFunction · 0.70

Calls 3

ComputeInfoFunction · 0.92
SpecMethod · 0.65
EffectiveTimeMethod · 0.65

Tested by 6

Test_ReportJsonFunction · 0.56
Test_ReportYamlFunction · 0.56
Test_ReportSummaryFunction · 0.56
Test_ReportTextFunction · 0.56