Debian Codegraph @

sarif/reporting_descriptor.go

raw symbols SCIP
1 package sarif
2
3 // ReportingConfiguration ...
4 type ReportingConfiguration struct {
5 Enabled bool `json:"enabled,omitempty"`
6 Level interface{} `json:"level,omitempty"`
7 Parameters *PropertyBag `json:"parameters,omitempty"`
8 Properties *PropertyBag `json:"properties,omitempty"`
9 Rank float64 `json:"rank,omitempty"`
10 }
11
12 // ReportingDescriptor specifies a Sarif ReportingDescriptor object
13 type ReportingDescriptor struct {
14 PropertyBag
15 ID string `json:"id"`
16 Name *string `json:"name,omitempty"`
17 ShortDescription *MultiformatMessageString `json:"shortDescription"`
18 FullDescription *MultiformatMessageString `json:"fullDescription,omitempty"`
19 DefaultConfiguration *ReportingConfiguration `json:"defaultConfiguration,omitempty"`
20 HelpURI *string `json:"helpUri,omitempty"`
21 Help *MultiformatMessageString `json:"help,omitempty"`
22 Properties Properties `json:"properties,omitempty"`
23 }
24
25 func newRule(ruleID string) *ReportingDescriptor {
26 return &ReportingDescriptor{
27 ID: ruleID,
28 }
29 }
30
31 // WithName specifies rule name that is understandable to an end user and returns the updated rule.
32 func (rule *ReportingDescriptor) WithName(name string) *ReportingDescriptor {
33 rule.Name = &name
34 return rule
35 }
36
37 // WithDescription specifies short description for a rule and returns the updated rule.
38 // Short description should be a single sentence that is understandable when visible space is limited to a single line
39 // of text.
40 func (rule *ReportingDescriptor) WithDescription(description string) *ReportingDescriptor {
41 rule.ShortDescription = NewMultiformatMessageString(description)
42 return rule
43 }
44
45 // WithShortDescription specifies short description for a rule and returns the updated rule.
46 // Short description should be a single sentence that is understandable when visible space is limited to a single line
47 // of text.
48 func (rule *ReportingDescriptor) WithShortDescription(description *MultiformatMessageString) *ReportingDescriptor {
49 rule.ShortDescription = description
50 return rule
51 }
52
53 // WithFullDescription specifies full description for a rule and returns the updated rule.
54 // Full description should, as far as possible, provide details sufficient to enable resolution of any problem indicated
55 // by the result.
56 func (rule *ReportingDescriptor) WithFullDescription(description *MultiformatMessageString) *ReportingDescriptor {
57 rule.FullDescription = description
58 return rule
59 }
60
61 // WithHelpURI specifies a helpURI for a rule and returns the updated rule
62 func (rule *ReportingDescriptor) WithHelpURI(helpURI string) *ReportingDescriptor {
63 rule.HelpURI = &helpURI
64 return rule
65 }
66
67 // WithHelp specifies a help text for a rule and returns the updated rule
68 func (rule *ReportingDescriptor) WithHelp(helpText string) *ReportingDescriptor {
69 rule.Help = NewMultiformatMessageString(helpText)
70 return rule
71 }
72
73 // WithMarkdownHelp specifies a help text for a rule and returns the updated rule
74 func (rule *ReportingDescriptor) WithMarkdownHelp(markdownText string) *ReportingDescriptor {
75 if rule.Help == nil {
76 rule.Help = NewMultiformatMessageString("")
77 }
78 rule.Help.WithMarkdown(markdownText)
79 return rule
80 }
81
82 // WithProperties specifies properties for a rule and returns the updated rule
83 func (rule *ReportingDescriptor) WithProperties(properties Properties) *ReportingDescriptor {
84 rule.Properties = properties
85 return rule
86 }
87
88 // AttachPropertyBag adds a property bag to a rule
89 func (rule *ReportingDescriptor) AttachPropertyBag(pb *PropertyBag) {
90 rule.Properties = pb.Properties
91 }