Skip to main content
Product Context Dependency is a powerful feature that allows you to enforce fine-grained control over component usage within your codebase. Instead of simply tracking which components exist, you can define rules about where they should (and shouldn’t) be used.

Prerequisites

Ensure scanoss-py is installed:
For enhanced performance with fast winnowing:
Verify installation:

Getting Started

Initial Discovery Scan

Run a comprehensive scan to discover all components in your project:
Options explained:
  • -D or --dependencies: Enable dependency detection
  • -o results.json: Output file for scan results
  • /path/to/folder: Scan the specified folder. You can use . to scan the current directory.
The first scan should be run without a scanoss.json file to discover all components in your project.

Identify Undeclared Components

Inspect the scan results to find components not yet declared in your configuration:
Sample Output:

Create scanoss.json Configuration

Create a scanoss.json file in the same directory you’re scanning to declare approved components:

Rescan with Configuration

Apply your configuration by rescanning with the settings file:
The tool will now detect scanoss.json in the scan directory.

Validate Compliance

After scanning with your configuration, verify that all components are properly declared:
Success output:
The output will list any undeclared components that need to be added to your scanoss.json.

Advanced Context Rules

Path-Specific Restrictions

Restrict components to specific directories in your project:

Version Upgrade Management

Enforce version upgrades or library replacements:

License Compliance Configuration

Based on the mixed licenses detected in your scan:
Learn more about creating and managing scanoss.json files: SCANOSS Settings Documentation