@@ -21,9 +21,16 @@ type AnalyzeJsonCompare struct {
2121}
2222
2323func (a * AnalyzeJsonCompare ) Title () string {
24- title := a .analyzer .CheckName
24+ return jsonCompareTitle (a .analyzer )
25+ }
26+
27+ func jsonCompareTitle (analyser * troubleshootv1beta2.JsonCompare ) string {
28+ title := analyser .CheckName
29+ if title == "" {
30+ title = analyser .CollectorName
31+ }
2532 if title == "" {
26- title = a . analyzer . CollectorName
33+ title = "Json Compare"
2734 }
2835
2936 return title
@@ -34,15 +41,15 @@ func (a *AnalyzeJsonCompare) IsExcluded() (bool, error) {
3441}
3542
3643func (a * AnalyzeJsonCompare ) Analyze (getFile getCollectedFileContents , findFiles getChildCollectedFileContents ) ([]* AnalyzeResult , error ) {
37- result , err := a . analyzeJsonCompare (a .analyzer , getFile )
44+ result , err := analyzeJsonCompare (a .analyzer , getFile , a . Title () )
3845 if err != nil {
3946 return nil , err
4047 }
4148 result .Strict = a .analyzer .Strict .BoolOrDefaultFalse ()
4249 return []* AnalyzeResult {result }, nil
4350}
4451
45- func ( a * AnalyzeJsonCompare ) analyzeJsonCompare (analyzer * troubleshootv1beta2.JsonCompare , getCollectedFileContents func (string ) ([]byte , error )) (* AnalyzeResult , error ) {
52+ func analyzeJsonCompare (analyzer * troubleshootv1beta2.JsonCompare , getCollectedFileContents func (string ) ([]byte , error ), title string ) (* AnalyzeResult , error ) {
4653 fullPath := filepath .Join (analyzer .CollectorName , analyzer .FileName )
4754 collected , err := getCollectedFileContents (fullPath )
4855 if err != nil {
@@ -97,7 +104,7 @@ func (a *AnalyzeJsonCompare) analyzeJsonCompare(analyzer *troubleshootv1beta2.Js
97104 }
98105
99106 result := & AnalyzeResult {
100- Title : a . Title () ,
107+ Title : title ,
101108 IconKey : "kubernetes_text_analyze" ,
102109 IconURI : "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg" ,
103110 }
@@ -173,7 +180,7 @@ func (a *AnalyzeJsonCompare) analyzeJsonCompare(analyzer *troubleshootv1beta2.Js
173180 }
174181
175182 return & AnalyzeResult {
176- Title : a . Title () ,
183+ Title : title ,
177184 IconKey : "kubernetes_text_analyze" ,
178185 IconURI : "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg" ,
179186 IsFail : true ,
0 commit comments