@@ -8,7 +8,7 @@ type Analyzer interface {
88 Analyze (path string , withTrace bool ) ([]* Issue , error )
99
1010 // TraceStack generates callstack for a function to debug
11- TraceStack (path string , function string ) (* IssueSource , error )
11+ TraceStack (path string , function string ) (* CallStack , error )
1212}
1313
1414// IssueSeverity represents the severity level of an issue.
@@ -21,32 +21,34 @@ const (
2121
2222// Issue represents a single issue found by the analyzer.
2323type Issue struct {
24- Sources * IssueSource `json:"sources"`
25- Message string `json:"message"` // A description of the issue.
26- Severity IssueSeverity `json:"severity"`
24+ CallStack * CallStack `json:"callStack"`
25+ Message string `json:"message"` // A description of the issue.
26+ Severity IssueSeverity `json:"severity"`
27+ Impact string `json:"impact,omitempty"`
28+ Reference string `json:"reference,omitempty"`
2729}
2830
29- // IssueSource represents a location in the code where the issue originates.
30- type IssueSource struct {
31- File string `json:"file"`
32- Line int `json:"line"` // The line number where the issue was found.
33- Function string `json:"function"` // The function where the issue was found.
34- AbsPath string `json:"absPath"` // The absolute file path.
35- CallStack * IssueSource `json:"callStack,omitempty"` // The trace of calls leading to this source.
31+ // CallStack represents a location in the code where the issue originates.
32+ type CallStack struct {
33+ File string `json:"file"`
34+ Line int `json:"line"` // The line number where the issue was found.
35+ Function string `json:"function"` // The function where the issue was found.
36+ AbsPath string `json:"absPath"` // The absolute file path.
37+ CallStack * CallStack `json:"callStack,omitempty"` // The trace of calls leading to this source.
3638}
3739
38- // Copy creates a deep copy of the IssueSource .
39- func (src * IssueSource ) Copy () * IssueSource {
40+ // Copy creates a deep copy of the CallStack .
41+ func (src * CallStack ) Copy () * CallStack {
4042 if src == nil {
4143 return nil
4244 }
4345 // Recursively copy the CallStack
44- var copiedCallStack * IssueSource
46+ var copiedCallStack * CallStack
4547 if src .CallStack != nil {
4648 copiedCallStack = src .CallStack .Copy ()
4749 }
4850
49- return & IssueSource {
51+ return & CallStack {
5052 File : src .File ,
5153 Line : src .Line ,
5254 Function : src .Function ,
@@ -56,7 +58,7 @@ func (src *IssueSource) Copy() *IssueSource {
5658}
5759
5860// AddCallStack add a call stack to the stack et end
59- func (src * IssueSource ) AddCallStack (stack * IssueSource ) {
61+ func (src * CallStack ) AddCallStack (stack * CallStack ) {
6062 // Recursively copy the CallStack
6163 if src .CallStack == nil {
6264 src .CallStack = stack
0 commit comments