Add --no_merge option for source scanner - #187
Conversation
📝 WalkthroughWalkthroughThis PR adds a Changesno_merge option support
Estimated code review effort: 2 (Simple) | ~15 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant Settings
participant Scanner
participant SourceAnalysis
CLI->>Settings: read no_merge
Settings-->>CLI: return validated value
CLI->>Scanner: pass no_merge
Scanner->>SourceAnalysis: set merge behavior
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
55bdcf6 to
d04ba59
Compare
Signed-off-by: Park Wonjae <wonjae.park@lge.com>
d04ba59 to
a47689b
Compare
Signed-off-by: Park Wonjae <wonjae.park@lge.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/fosslight_scanner/fosslight_scanner.py (2)
267-268: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winBuild the Docker invocation as an argument list.
subprocess.run(command, ...)does not execute a shell.commandalready contains a shell-quoted full command, so on POSIX it is treated as one executable name. The Docker source-analysis path fails before it can apply--no_merge.Use a list such as
["docker", "run", ..., "--no_merge"]. Add each optional argument as a separate list element. Do not applyshlex.quotewhenshell=False.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/fosslight_scanner/fosslight_scanner.py` around lines 267 - 268, Update the Docker source-analysis command construction around the no_merge option to use a list of separate arguments for subprocess.run instead of a shell-quoted command string. Build the invocation beginning with the Docker executable and append required and optional arguments, including --no_merge, as individual elements; remove shlex.quote usage while retaining shell=False behavior.
374-374: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winRemove the unused unpacked values.
final_excel_dirandresult_logare not used afterinit(out_dir). Ruff reportsRUF059for both bindings. Replace them with_.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/fosslight_scanner/fosslight_scanner.py` at line 374, Update the init(out_dir) assignment to bind the unused final_excel_dir and result_log return values to _ while preserving the success binding.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/fosslight_scanner/fosslight_scanner.py`:
- Around line 267-268: Update the Docker source-analysis command construction
around the no_merge option to use a list of separate arguments for
subprocess.run instead of a shell-quoted command string. Build the invocation
beginning with the Docker executable and append required and optional arguments,
including --no_merge, as individual elements; remove shlex.quote usage while
retaining shell=False behavior.
- Line 374: Update the init(out_dir) assignment to bind the unused
final_excel_dir and result_log return values to _ while preserving the success
binding.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: d90725fc-d30d-47e3-9d7b-509bfbd1ccbd
📒 Files selected for processing (2)
pyproject.tomlsrc/fosslight_scanner/fosslight_scanner.py
🚧 Files skipped from review as they are similar to previous changes (1)
- pyproject.toml
--no_mergecommand-line and settings option to FOSSLight Scanner to prevent folder-level merging during source code analysis.merge_by_folder) and to the container-based scan flow.--no_mergeoption in the help message.test_cli.pyandtest__parse_setting.pyto match the updated return signature of parsing functions.Summary by CodeRabbit
--no_mergeoption to keep source scan results file-based instead of merging by folder.no_mergevalues now default safely.