Skip to content

Conversation

@matiasdaloia
Copy link
Contributor

@matiasdaloia matiasdaloia commented Oct 28, 2025

Summary by CodeRabbit

  • New Features

    • Added gRPC support to folder hashing scans; --grpc flag now enables gRPC-backed scanning for folder hashing operations.
    • Extended --output flag support to folder_scan command for flexible output handling.
  • Style

    • Minor CLI argument formatting adjustments.

@matiasdaloia matiasdaloia self-assigned this Oct 28, 2025
@matiasdaloia matiasdaloia added the enhancement New feature or request label Oct 28, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 28, 2025

Walkthrough

This PR propagates gRPC usage through the folder hashing workflow by adding a use_grpc parameter to ScannerHFH, threading it from the CLI, and updating folder_hash_scan to conditionally delegate to REST or gRPC paths based on the flag.

Changes

Cohort / File(s) Summary
CLI argument propagation
src/scanoss/cli.py
Minor formatting consolidation of CLI arguments for GitLab matches command; added use_grpc=args.grpc parameter to ScannerHFH in folder_hashing_scan to enable gRPC-backed scanning; extended global options to include folder_scan in gRPC-enabled group; added folder_scan to universal output options loop.
Scanner implementation
src/scanoss/scanners/scanner_hfh.py
Added use_grpc: bool = False parameter to constructor; stored as instance attribute; updated scan() method to pass self.use_grpc to self.client.folder_hash_scan() call.
gRPC interface
src/scanoss/scanossgrpc.py
Added optional use_grpc: Optional[bool] = None parameter to folder_hash_scan method; conditional delegation to REST path via _call_api when flag is set instead of RPC path; updated docstring to document new parameter.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Changes follow a consistent parameter-threading pattern across three files with minimal logic modifications
  • No significant algorithmic changes or complex control flows introduced
  • Parameter propagation is straightforward from CLI through scanner to gRPC interface

Possibly related PRs

Suggested reviewers

  • eeisegn

Poem

🐰 A flag hops along the scanner's trail,
From CLI through the gRPC tale,
REST or RPC, now choose with flair—
The folder hash flows without a care! 🚀

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "SP-3549 feat: add rest support for folder scan command" is directly related to and clearly summarizes the main change in the changeset. The summary shows that the PR introduces a use_grpc parameter throughout the stack (CLI, ScannerHFH, and scanossgrpc modules) that enables switching from the default gRPC path to a REST-based path via the _call_api method for folder scanning operations. The title is concise, specific, and clearly communicates the primary enhancement to a teammate reviewing the repository history.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/mdaloia/SP-3549-Switch-Folder-Hashing-client-to-REST

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d04af9 and 32ee178.

📒 Files selected for processing (3)
  • src/scanoss/cli.py (7 hunks)
  • src/scanoss/scanners/scanner_hfh.py (3 hunks)
  • src/scanoss/scanossgrpc.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/scanoss/scanossgrpc.py (1)
src/scanoss/api/scanning/v2/scanoss_scanning_pb2_grpc.py (2)
  • FolderHashScan (64-69)
  • FolderHashScan (125-149)
src/scanoss/scanners/scanner_hfh.py (1)
src/scanoss/scanossgrpc.py (1)
  • folder_hash_scan (429-447)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (5)
src/scanoss/scanossgrpc.py (1)

429-447: LGTM! Consistent implementation.

The use_grpc parameter addition follows the established pattern used by other API methods in this class (e.g., get_vulnerabilities_json, get_semgrep_json). The docstring correctly documents the new parameter.

src/scanoss/scanners/scanner_hfh.py (1)

111-111: LGTM! Parameter correctly stored and used.

The use_grpc parameter is properly stored as an instance variable and passed to the folder hash scan method.

src/scanoss/cli.py (3)

832-852: Minor help text improvements.

The help text for the GitLab matches inspection command has been clarified to better describe the input, line range prefix, and output arguments.


1187-1191: LGTM! Enables REST/gRPC selection for folder scanning.

Adding p_folder_scan to the gRPC options group correctly propagates the --grpc/--rest command-line flags to the folder scan command, enabling users to choose between REST and gRPC APIs.


2673-2673: LGTM! Correctly passes protocol selection to scanner.

The use_grpc=args.grpc argument properly propagates the command-line flag to the ScannerHFH constructor, enabling the chosen communication protocol (REST or gRPC) for folder hash scanning.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

SCANOSS SCAN Completed 🚀

  • Detected components: 1
  • Undeclared components: 0
  • Declared components: 1
  • Detected files: 71
  • Detected files undeclared: 0
  • Detected files declared: 71
  • Licenses detected: 1
  • Licenses detected with copyleft: 0
  • Policies: ✅ 1 pass (1 total)

View more details on SCANOSS Action Summary

@matiasdaloia matiasdaloia merged commit 8c44231 into main Oct 29, 2025
6 checks passed
@matiasdaloia matiasdaloia deleted the feature/mdaloia/SP-3549-Switch-Folder-Hashing-client-to-REST branch October 29, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants