Skip to content

Commit 752788e

Browse files
agustingrohAlex-1089eeisegn
authored
Feat/dep track inspection (#140)
* chore:SP-2960 Refactor inspect module * feat:SP-2961 Implements dependency track inspect task * chore:SP-2967 Adds source(raw, dependency-track) to inspect subcommand * chore:SP-2969 Adds backward compatibility for the legacy inspect command * Fixed bug SP-2985 --------- Co-authored-by: Alex Egan <[email protected]> Co-authored-by: eeisegn <[email protected]>
1 parent bb60a43 commit 752788e

19 files changed

+1686
-477
lines changed

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
- Upcoming changes...
1111

12+
## [1.31.0] - 2025-08-08
13+
### Added
14+
- Add `inspect dependency-track project-violations` subcommand to retrieve Dependency Track project violations in Markdown and JSON formats
15+
### Changed
16+
- Renamed `inspect copyleft` to `inspect raw copyleft`
17+
- Renamed `inspect undeclared` to `inspect raw undeclared`
18+
- Renamed `inspect component-summary` to `inspect raw component-summary`
19+
- Renamed `inspect license-summary` to `inspect raw license-summary`
20+
- Updated Policy return codes. 0 → Success, 2 → Fail, 1 → Error
21+
### Fixed
22+
- Fixed incorrect folder filtering configurations for fingerprinting and scanning
23+
1224
## [1.30.0] - 2025-07-22
1325
### Added
1426
- Add `export dt` subcommand to export SBOM files to Dependency Track
@@ -615,5 +627,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
615627
[1.28.2]: https://github.com/scanoss/scanoss.py/compare/v1.28.1...v1.28.2
616628
[1.29.0]: https://github.com/scanoss/scanoss.py/compare/v1.28.2...v1.29.0
617629
[1.30.0]: https://github.com/scanoss/scanoss.py/compare/v1.29.0...v1.30.0
618-
630+
[1.31.0]: https://github.com/scanoss/scanoss.py/compare/v1.30.0...v1.31.0
619631

CLIENT_HELP.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,11 @@ The `inspect` command has a suite of sub-commands designed to inspect the result
367367
Details, such as license compliance or component declarations, can be examined.
368368

369369
For example:
370-
* Copyleft (`copylefet`)
370+
* Copyleft (`copyleft`)
371371
* Undeclared Components (`undeclared`)
372372
* License Summary (`license-summary`)
373373
* Component Summary (`component-summary`)
374+
* Dependency Track project violations (`dependency-track project-violations`)
374375

375376
For the latest list of sub-commands, please run:
376377
```bash
@@ -476,6 +477,21 @@ Example with an output file:
476477
scanoss-py insp component-summary -i scan-results.json --output component-summary.json
477478
```
478479

480+
#### Inspect Dependency Track project violations Markdown output
481+
The following command can be used to retrieve project violations from Dependency Track in Markdown format.
482+
483+
**Note:** The upload token is optional. It is used to check the project processing status. If no token is provided, the latest project violations will be retrieved without waiting for project processing to complete.
484+
485+
Example with project id:
486+
```bash
487+
scanoss-py inspect dt project-violations --dt-upload-token <dt-upload-token> --dt-url <dependency-track-url> --dt-projectid <dependency-track-project-id> --dt-apikey <dependency-track-api-key> --format md --output project-violations.md
488+
```
489+
Example with project name and version:
490+
```bash
491+
scanoss-py inspect dt project-violations --dt-upload-token <dt-upload-token> --dt-url <dependency-track-url> --dt-projectname <dependency-track-project-name> --dt-projectversion <dependency-track-project-version> --dt-apikey <dependency-track-api-key> --format md --output project-violations.md
492+
```
493+
494+
479495
### Folder-Scan a Project Folder
480496

481497
The new `folder-scan` subcommand performs a comprehensive scan on an entire directory by recursively processing files to generate folder-level fingerprints. It computes CRC64 hashes and simhash values to detect directory-level similarities, which is especially useful for comparing large code bases or detecting duplicate folder structures.

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ FROM base AS builder
1010

1111
# Setup the required build tooling
1212
RUN apt-get update \
13-
&& apt-get install -y --no-install-recommends build-essential gcc \
13+
&& apt-get install -y --no-install-recommends build-essential gcc libicu-dev pkg-config \
1414
&& apt-get clean \
1515
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
1616

@@ -54,9 +54,9 @@ COPY --from=builder /opt/venv /opt/venv
5454
ENV PATH=/opt/venv/bin:$PATH
5555
ENV GRPC_POLL_STRATEGY=poll
5656

57-
# Install jq and curl commands
57+
# Install jq and curl commands and ICU runtime library
5858
RUN apt-get update \
59-
&& apt-get install -y --no-install-recommends jq curl \
59+
&& apt-get install -y --no-install-recommends jq curl libicu72 \
6060
&& apt-get clean \
6161
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
6262

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Calculates hashes for a directory or file and shows them on the STDOUT.
156156
- Fingerprint all hidden files/folders
157157

158158
-----------------------------------------
159-
Detect dependecies: dependencies, dp, dep
159+
Detect dependencies: dependencies, dp, dep
160160
-----------------------------------------
161161

162162
Scan source code for dependencies, but do not decorate them.

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[tool.ruff]
66
# Enable pycodestyle (E), pyflakes (F), isort (I), pylint (PL)
7-
select = ["E", "F", "I", "PL"]
7+
lint.select = ["E", "F", "I", "PL"]
88
line-length = 120
99
# Assume Python 3.9+
1010
target-version = "py39"
@@ -22,3 +22,6 @@ line-ending = "auto"
2222

2323
[tool.ruff.lint.isort]
2424
known-first-party = ["scanoss"]
25+
26+
[tool.ruff.lint.pylint]
27+
max-args = 5

src/__init__.py

Whitespace-only changes.

src/scanoss/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
THE SOFTWARE.
2323
"""
2424

25-
__version__ = '1.30.0'
25+
__version__ = '1.31.0'

0 commit comments

Comments
 (0)