-
Notifications
You must be signed in to change notification settings - Fork 2
/
analysis_config.go
37 lines (32 loc) · 1.1 KB
/
analysis_config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package orchestrator
import (
"bytes"
artifact "github.com/DeepSourceCorp/artifacts/types"
"github.com/pelletier/go-toml"
)
type MarvinAnalysisConfig struct {
*artifact.MarvinAnalysisConfig
}
func NewMarvinAnalysisConfig(run *artifact.AnalysisRun, check artifact.Check) *MarvinAnalysisConfig {
return &MarvinAnalysisConfig{
MarvinAnalysisConfig: &artifact.MarvinAnalysisConfig{
RunID: run.RunID,
CheckSeq: check.CheckSeq,
AnalyzerShortcode: check.AnalyzerMeta.Shortcode,
AnalyzerCommand: check.AnalyzerMeta.Command,
BaseOID: run.VCSMeta.BaseOID,
CheckoutOID: run.VCSMeta.CheckoutOID,
IsForDefaultAnalysisBranch: run.VCSMeta.IsForDefaultAnalysisBranch,
DSConfigUpdated: run.DSConfigUpdated,
Processors: check.Processors,
DiffMetaCommits: check.DiffMetaCommits,
},
}
}
func (c *MarvinAnalysisConfig) Bytes() ([]byte, error) {
var buf bytes.Buffer
if err := toml.NewEncoder(&buf).Encode(c); err != nil {
return nil, err
}
return buf.Bytes(), nil
}