Skip to content

Commit

Permalink
🐛 skip windup-shim if .net framework analysis (#299)
Browse files Browse the repository at this point in the history
Signed-off-by: David Zager <[email protected]>
  • Loading branch information
djzager authored Aug 1, 2024
1 parent 519c492 commit a6ea418
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,6 @@ func NewAnalyzeCmd(log logr.Logger) *cobra.Command {
if analyzeCmd.providersMap == nil {
analyzeCmd.providersMap = make(map[string]ProviderInit)
}
xmlOutputDir, err := analyzeCmd.ConvertXML(cmd.Context())
if err != nil {
log.Error(err, "failed to convert xml rules")
return err
}
languages, err := recognizer.Analyze(analyzeCmd.input)
if err != nil {
log.Error(err, "Failed to determine languages for input")
Expand All @@ -221,17 +216,6 @@ func NewAnalyzeCmd(log logr.Logger) *cobra.Command {
log.Error(err, "failed to set provider info")
return err
}
// alizer does not detect certain files such as xml
// in this case we need to run only the analyzer to use builtin provider
if len(foundProviders) == 0 {
analyzeCmd.needsBuiltin = true
err = analyzeCmd.RunAnalysis(cmd.Context(), xmlOutputDir, analyzeCmd.input)
if err != nil {
log.Error(err, "failed to run analysis")
return err
}
return nil
}
err = analyzeCmd.validateProviders(foundProviders)
if err != nil {
return err
Expand All @@ -240,6 +224,18 @@ func NewAnalyzeCmd(log logr.Logger) *cobra.Command {
if len(foundProviders) == 1 && foundProviders[0] == dotnetFrameworkProvider {
return analyzeCmd.analyzeDotnetFramework(cmd.Context())
}
xmlOutputDir, err := analyzeCmd.ConvertXML(cmd.Context())
if err != nil {
log.Error(err, "failed to convert xml rules")
return err
}
// alizer does not detect certain files such as xml
// in this case we need to run only the analyzer to use builtin provider
if len(foundProviders) == 0 {
analyzeCmd.needsBuiltin = true
return analyzeCmd.RunAnalysis(cmd.Context(), xmlOutputDir, analyzeCmd.input)
}

err = analyzeCmd.setProviderInitInfo(foundProviders)
if err != nil {
log.Error(err, "failed to set provider init info")
Expand Down

0 comments on commit a6ea418

Please sign in to comment.