@@ -17,6 +17,7 @@ import (
1717 "github.com/aquasecurity/trivy/pkg/fanal/analyzer"
1818 "github.com/aquasecurity/trivy/pkg/fanal/analyzer/language"
1919 "github.com/aquasecurity/trivy/pkg/fanal/types"
20+ "github.com/aquasecurity/trivy/pkg/log"
2021 "github.com/aquasecurity/trivy/pkg/utils/fsutils"
2122)
2223
@@ -39,19 +40,24 @@ type nugetLibraryAnalyzer struct {
3940 lockParser language.Parser
4041 configParser language.Parser
4142 licenseParser nuspecParser
43+ logger * log.Logger
4244}
4345
4446func newNugetLibraryAnalyzer (_ analyzer.AnalyzerOptions ) (analyzer.PostAnalyzer , error ) {
4547 return & nugetLibraryAnalyzer {
4648 lockParser : lock .NewParser (),
4749 configParser : config .NewParser (),
4850 licenseParser : newNuspecParser (),
51+ logger : log .WithPrefix ("nuget" ),
4952 }, nil
5053}
5154
5255func (a * nugetLibraryAnalyzer ) PostAnalyze (_ context.Context , input analyzer.PostAnalysisInput ) (* analyzer.AnalysisResult , error ) {
5356 var apps []types.Application
5457 foundLicenses := make (map [string ][]string )
58+ if a .licenseParser .packagesDir == "" {
59+ a .logger .Debug ("The nuget packages directory couldn't be found. License search disabled" )
60+ }
5561
5662 // We saved only config and lock files in the FS,
5763 // so we need to parse all saved files
0 commit comments