-
Notifications
You must be signed in to change notification settings - Fork 80
Property to exclude individual detectors #1546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
} | ||
|
||
@NotNull | ||
public DetectableEnvironment getEnvironment() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This removal wasn't strictly necessary, but since this method seems to have been around for years and never used, I decided to remove it.
} | ||
|
||
DetectableDefinition definition = entryPoint.getPrimary(); | ||
if (detectableExclusionEvaluator.isDetectableExcluded(definition)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if statement is the primary addition here. Most of the rest of this method was simply extracted from a for loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new configuration property detect.excluded.detectors
that allows users to exclude individual detectors by name, providing more granular control than the existing detector type exclusions.
- Added
DetectableExclusionEvaluator
class to handle detector exclusion logic - Integrated the exclusion evaluator into the detector evaluation pipeline
- Updated error messages and documentation to reference the new property
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
DetectProperties.java | Adds the new DETECT_EXCLUDED_DETECTORS property definition |
DetectConfigurationFactory.java | Adds method to retrieve excluded detectors from configuration |
OperationRunner.java | Integrates the exclusion evaluator into the detector execution flow |
DetectableExclusionEvaluator.java | New class implementing case-insensitive, space-agnostic detector name matching |
DetectorRuleEvaluator.java | Modified to use the exclusion evaluator and refactored evaluation logic |
DetectorRuleEvaluation.java | Removed unused DetectableEnvironment parameter |
DetectableEvaluator.java | Simplified method signature by moving Detectable creation upstream |
ExitCodeType.java | Updated error message to reference new exclusion property |
currentreleasenotes.md | Added release note for the new feature |
DetectableExclusionEvaluatorTest.java | Comprehensive test coverage for exclusion logic |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/main/java/com/blackduck/integration/detect/configuration/DetectProperties.java
Outdated
Show resolved
Hide resolved
.../main/java/com/blackduck/integration/detector/accuracy/entrypoint/DetectorRuleEvaluator.java
Outdated
Show resolved
Hide resolved
…racy/entrypoint/DetectorRuleEvaluator.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…etectProperties.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
FAILURE_POLICY_VIOLATION(3, "Detect found policy violations."), | ||
FAILURE_PROXY_CONNECTIVITY(4, "Detect was unable to use the configured proxy. Check your configuration and connection."), | ||
FAILURE_DETECTOR(5, "Detect had one or more detector failures while extracting dependencies. Check that all projects build and your environment is configured correctly."), | ||
FAILURE_DETECTOR(5, "Detect had one or more detector failures while extracting dependencies. Check that all projects build and your environment is configured correctly. Alternatively, consider disabling individual Detectors using the --" + DetectProperties.DETECT_EXCLUDED_DETECTORS.getKey() + " property."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure if I'm for or against this...think for as it might get some users out of the woods...but just want to point out that there are a few other things that could correct this behavior, depending on what happened, and we don't really mention them here. Might be worth some discussion with the team.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I was on the fence about this as well. I will hold off merging until we get a chance to chat about it early next week.
…cs (#1550) * Add test that ensures that detectable names in code match those in docs * Format comment * Update src/test/java/com/blackduck/integration/detect/tool/detector/DetectorRuleFactoryTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix test syntax --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Description
Property
detect.excluded.detectors
to exclude individual detectors.This provides more granularity on top of pre-existing inclusion/exclusion properties.