microsoft / microsoft/component-detection

Allow DefaultOff detectors to be used exclusively

Open
#1,457 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
553
Forks
135
Avg merge
20h 58m
Merged PRs (30d)
6

Description

I would like to use UvLock exclusively due to it being the detector with the best accuracy. As PipReport (and Pip) detectors seems to be highly inaccurate

PipReport - 8 dependencies found, 8 Explicitly Referenced
Pip - 9 dependencies found, 8 Explicitly Referenced
UvLock - 17 dependencies found, 2 Explicitly Referenced

# Reproduction steps

Create the following file
```
# pyproject.toml

[project]
name = "hello_world"
version = "1.0.0"
description = "A simple Hello World Python project."
requires-python = ">=3.10"
dependencies = [
"orjson>3.10.0",
"Flask==3.1.1"
]

[dependency-groups]
dev = [
"pytest"
]
```

Run the commands
`uv sync`
`component-detection scan --SourceDirectory . --ManifestFile output.json --DetectorArgs UvLock=EnableIfDefaultOff`

# Expected
Successful manifest generation using `UvLock` as the only detector

# Actual
```
An error occurred while executing the command
Microsoft.ComponentDetection.Orchestrator.Exceptions.InvalidDetectorFilterException: Detector 'UvLock' was not found
at Microsoft.ComponentDetection.Orchestrator.Services.DetectorRestrictionService.ApplyRestrictions(DetectorRestrictions restrictions, IEnumerable`1 detectors)
at Microsoft.ComponentDetection.Orchestrator.Services.ScanExecutionService.ExecuteScanAsync(ScanSettings settings)
at Microsoft.ComponentDetection.Orchestrator.Commands.ScanCommand.ExecuteAsync(CommandContext context, ScanSettings settings)
at Spectre.Console.Cli.CommandExecutor.Execute(CommandTree leaf, CommandTree tree, CommandContext context, ITypeResolver resolver, IConfiguration configuration) in /_/src/Spectre.Console.Cli/Internal/CommandExecutor.cs:line 166
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the scan with the provided pyproject.toml, uv sync, and DetectorArgs command. Start at DetectorRestrictionService.ApplyRestrictions and the scan execution path shown in the error; done means UvLock is recognized and can run as the only detector without InvalidDetectorFilterException.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.