microsoft / component-detection

Scans your project to determine what components you use
MIT License
438 stars 90 forks source link

Add logs to MvnCLI and use dictionaries to improve perf on large repos #1213

Closed grvillic closed 3 months ago

grvillic commented 3 months ago

Context

MvnCLI can hang when scanning directories with significant amount of pom.xmls. At the moment it is hard to tell if this is bug in the detector itself or Mvn CLI APIs.

Solution

We are adding logs to be able to improve troubleshooting the detector, and we are also introducing a build variable called MvnCLIFileLevelTimeoutSeconds that will allow users restrict max time execution per each processed file. Screenshot below on how the logs when the build variable sets a very low threshold, and the tool cancels the command's execution.

image

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 84.21053% with 9 lines in your changes missing coverage. Please review.

Project coverage is 76.4%. Comparing base (80cff26) to head (da07236).

Files Patch % Lines
...ntDetection.Detectors/maven/MavenCommandService.cs 78.5% 4 Missing and 2 partials :warning:
...tection.Detectors/maven/MvnCliComponentDetector.cs 88.4% 1 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1213 +/- ## ===================================== Coverage 76.4% 76.4% ===================================== Files 258 259 +1 Lines 11637 11655 +18 Branches 1172 1175 +3 ===================================== + Hits 8896 8910 +14 - Misses 2404 2406 +2 - Partials 337 339 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 3 months ago

👋 Hi! It looks like you modified some files in the Detectors folder. You may need to bump the detector versions if any of the following scenarios apply:

If none of the above scenarios apply, feel free to ignore this comment 🙂