5454 Required : false ,
5555 Value : false ,
5656 }
57+ SkipWarnings = & cli.BoolFlag {
58+ Name : "skip-warnings" ,
59+ Usage : "skip the issue with severity warning" ,
60+ Required : false ,
61+ Value : false ,
62+ }
5763
5864 BaselineReport = & cli.StringFlag {
5965 Name : "baseline-report" ,
@@ -76,6 +82,7 @@ func CreateAnalyzeCommand(action cli.ActionFunc) *cli.Command {
7682 FormatFlag ,
7783 ReportOutputPathFlag ,
7884 TraceFlag ,
85+ SkipWarnings ,
7986 BaselineReport ,
8087 },
8188 }
@@ -104,14 +111,15 @@ func AnalyzeCompatibility(ctx *cli.Context) error {
104111 reportOutputPath := ctx .Path (ReportOutputPathFlag .Name )
105112 analysisType := ctx .String (AnalysisTypeFlag .Name )
106113 withTrace := ctx .Bool (TraceFlag .Name )
114+ skipWarnings := ctx .Bool (SkipWarnings .Name )
107115 baselineReport := ctx .Path (BaselineReport .Name )
108116
109117 disassemblyPath , err = disassemble (vmProfile , source , disassemblyPath )
110118 if err != nil {
111119 return fmt .Errorf ("error disassembling the file: %w" , err )
112120 }
113121
114- issues , err := analyze (vmProfile , disassemblyPath , analysisType , withTrace )
122+ issues , err := analyze (vmProfile , disassemblyPath , analysisType , withTrace , skipWarnings )
115123 if err != nil {
116124 return fmt .Errorf ("analysis failed: %w" , err )
117125 }
@@ -146,19 +154,19 @@ func disassemble(prof *profile.VMProfile, path, outputPath string) (string, erro
146154}
147155
148156// analyze runs the selected analyzer(s).
149- func analyze (prof * profile.VMProfile , disassemblyPath , mode string , withTrace bool ) ([]* analyzer.Issue , error ) {
157+ func analyze (prof * profile.VMProfile , disassemblyPath , mode string , withTrace bool , skipWarnings bool ) ([]* analyzer.Issue , error ) {
150158 if mode == "opcode" {
151- return opcode .NewAnalyser (prof ).Analyze (disassemblyPath , withTrace )
159+ return opcode .NewAnalyser (prof ).Analyze (disassemblyPath , withTrace , skipWarnings )
152160 }
153161 if mode == "syscall" {
154- return syscall .NewAssemblySyscallAnalyser (prof ).Analyze (disassemblyPath , withTrace )
162+ return syscall .NewAssemblySyscallAnalyser (prof ).Analyze (disassemblyPath , withTrace , skipWarnings )
155163 }
156164 // by default analyze both
157- opIssues , err := opcode .NewAnalyser (prof ).Analyze (disassemblyPath , withTrace )
165+ opIssues , err := opcode .NewAnalyser (prof ).Analyze (disassemblyPath , withTrace , skipWarnings )
158166 if err != nil {
159167 return nil , err
160168 }
161- sysIssues , err := syscall .NewAssemblySyscallAnalyser (prof ).Analyze (disassemblyPath , withTrace )
169+ sysIssues , err := syscall .NewAssemblySyscallAnalyser (prof ).Analyze (disassemblyPath , withTrace , skipWarnings )
162170 if err != nil {
163171 return nil , err
164172 }
0 commit comments