Skip to content

Conversation

@shantyk
Copy link
Contributor

@shantyk shantyk commented Dec 8, 2025

Highlights:

  • Option to point to a local NuGet inspector path (for ease of testing)
  • Passing a new argument to NuGet inspector called "nuget_inspected_files_path"
    ^ if NI runs, it will populate the invokedDetectorsAndTheirRelevantFiles,json file. Other Detectors will append. If NI is not invoked, Detect will create the file for the first time. PR: QuackPatch related changes (IDETECT-4933) detect-nuget-inspector#38
  • New Quack Patch related properties (including an Llm api token which we obscure when properties are printed to logs.)
  • Downloading of Rapid FULL results when Quack Patch is enabled

Test to confirm rapid FULL results schema (in case breaking changes are introduced at some point) + any doc related changes are pending.

@shantyk shantyk changed the title Enable quack, first round DRAFT: Enable quack, first round Dec 8, 2025
@shantyk shantyk changed the title DRAFT: Enable quack, first round (feature) QuackPatch MVP Jan 16, 2026
implementation 'com.blackducksoftware:method-analyzer-core:1.0.1'
implementation "${locatorGroup}:${locatorModule}:2.2.0"
// implementation "${locatorGroup}:${locatorModule}:2.2.0"
implementation files ("/Users/shanty/blackduck/gitlab-folder/component-locator/build/libs/component-locator-2.3.0-all.jar")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be replaced with version published to internal artifactory

@shantyk shantyk requested a review from bd-samratmuk January 20, 2026 12:48
@shantyk shantyk marked this pull request as ready for review January 20, 2026 16:29
private final File nugetInspectorPath;

public NugetInspectorOptions(boolean ignoreFailures, List<String> excludedModules, List<String> includedModules, List<String> packagesRepoUrl, @Nullable Path nugetConfigPath, Set<NugetDependencyType> nugetExcludedDependencyTypes, @Nullable Path nugetArtifactsPath) {
public NugetInspectorOptions(boolean ignoreFailures, List<String> excludedModules, List<String> includedModules, List<String> packagesRepoUrl, @Nullable Path nugetConfigPath, Set<NugetDependencyType> nugetExcludedDependencyTypes, @Nullable Path nugetArtifactsPath, Path inspectedFilesInfoPath, @Nullable File nugetInspectorPath) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When there are so many constructor arguments, it's a better choice to use builder pattern (widely used in detect) or passing any DTO as a container of the arguments to the constructor would improve readability.

logger.warn("Quack Patch cannot run when Component Location Analysis is also enabled. Disabling Quack Patch.");
return false;
}
if (isQuackPatchEnabled() && !isComponentLocationAnalysisEnabled()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could move this complex conditional check into a boolean variable or a small helper method call to make the code a bit cleaner.

Comment on lines 4 to 12

public class DetectPropertyUtil {
private DetectPropertyUtil() {
// Hiding the implicit public constructor
}

private static final Predicate<String> PASSWORDS_AND_TOKENS_PREDICATE = propertyKey ->
propertyKey.toLowerCase().contains("password")
|| propertyKey.toLowerCase().contains("api.token")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could move the string constants to static final string variables.
Or, we can maintain a static final set of string constants and use anyMatch(..) from the stream api to avoid multiple conditional check.

if (providedNugetInspectorPath.isPresent()) {
logger.info("Will attempt to use the provided NuGet inspector at " + providedNugetInspectorPath.get());
inspector = ExecutableTarget.forFile(providedNugetInspectorPath.get());
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can consider extracting the deeply nested conditional checks into another method or reordering the conditional checks to make the code a bit more readable.

detectorEventPublisher.publishDetectorsComplete(toolResult);

try {
saveExtractedDetectorsAndTheirRelevantFilePaths(directoryManager, toolResult);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick! The indentation seems to be misaligned.

public QuackPatchResult runQuackPatch(File scanOutputFolder, File rapidFullResultsFile, DetectConfigurationFactory configFactory) {
logger.info("Attempting Quack Patch.");

Map<String, List<String>> relevantDetectorsAndFiles = loadDetectorsAndFiles(scanOutputFolder.getAbsolutePath() + "/" + QUACKPATCH_SUBDIRECTORY_NAME + "/" + INVOKED_DETECTORS_AND_RELEVANT_FILES_JSON);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the "/" is the path separator, we could use java.io.File.separator to make this platform independent. The current code might produce an inconsistent path in windows machine.

import java.util.Collections;
import java.util.List;

public class QuackPatchResult implements DetectResult {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this class is left as todo, as the getters are returning empty strings. Is that so?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants