Cursor/pr193 consolidate fixes#197
Conversation
… error handling and documentation This PR consolidates changes from PR #191 and #192, which address issues identified in PR #185: - Fixed missing module reference to lib4sbom/quality.py in documentation - Enhanced error handling in CLI (fixops_sbom.py) with comprehensive try-except blocks - Improved error handling in normalizer with better error messages - Added comprehensive docstrings to all public functions - Created AI model comparison analysis document - Added pre-merge checks status documentation ✅ Black formatting - PASSED ✅ isort imports - PASSED ✅ Flake8 linting - PASSED ✅ Python syntax - PASSED ✅ Tests - All 5 SBOM quality tests PASSED - cli/fixops_sbom.py: Enhanced error handling and user experience - lib4sbom/normalizer.py: Improved error handling and documentation - analysis/VULNERABILITY_MANAGEMENT_GAPS_ANALYSIS.md: Fixed module reference - analysis/PR185_AI_MODEL_COMPARISON.md: Comprehensive AI model analysis - analysis/PR185_FIXES_SUMMARY.md: Summary of all fixes - analysis/PRE_MERGE_CHECKS_STATUS.md: Pre-merge checks documentation This PR can replace PR #191 and #192 once merged.
Co-authored-by: shivakumaar.umasudan <shivakumaar.umasudan@devopsai.co>
- Format 8 test files in APP2 and APP3 partner_simulators - Fixes black formatting check failures in CI - All pre-merge checks now passing
Co-authored-by: shivakumaar.umasudan <shivakumaar.umasudan@devopsai.co>
- Resolve merge conflict in VULNERABILITY_MANAGEMENT_GAPS_ANALYSIS.md - Remove .coverage binary file from git tracking - Fix syntax error in agents/core/agent_framework.py (indentation) - Remove unused asyncio import in agents/core/agent_orchestrator.py - Format all files with black and isort - All pre-merge checks now passing
… error handling and documentation This PR consolidates changes from PR #191 and #192, which address issues identified in PR #185: - Fixed missing module reference to lib4sbom/quality.py in documentation - Enhanced error handling in CLI (fixops_sbom.py) with comprehensive try-except blocks - Improved error handling in normalizer with better error messages - Added comprehensive docstrings to all public functions - Created AI model comparison analysis document - Added pre-merge checks status documentation ✅ Black formatting - PASSED ✅ isort imports - PASSED ✅ Flake8 linting - PASSED ✅ Python syntax - PASSED ✅ Tests - All 5 SBOM quality tests PASSED - cli/fixops_sbom.py: Enhanced error handling and user experience - lib4sbom/normalizer.py: Improved error handling and documentation - analysis/VULNERABILITY_MANAGEMENT_GAPS_ANALYSIS.md: Fixed module reference - analysis/PR185_AI_MODEL_COMPARISON.md: Comprehensive AI model analysis - analysis/PR185_FIXES_SUMMARY.md: Summary of all fixes - analysis/PRE_MERGE_CHECKS_STATUS.md: Pre-merge checks documentation This PR can replace PR #191 and #192 once merged.
There was a problem hiding this comment.
2 issues found across 108 files
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.
Prompt for AI agents (all 2 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="cli/fixops_sbom.py">
<violation number="1" location="cli/fixops_sbom.py:116">
P2: Misleading error message: after the `path.exists()` check succeeds, any `FileNotFoundError` here cannot be from `normalized_path` - it would come from `build_and_write_quality_outputs()` (e.g., output directory issues). Consider capturing the exception with `as e` and using a generic message.</violation>
</file>
<file name="risk/reachability/code_analysis.py">
<violation number="1" location="risk/reachability/code_analysis.py:427">
P1: Dict comprehension overwrites the 'pattern' key on each iteration, keeping only the last function. This should be a list comprehension to generate multiple pattern dictionaries for `pattern-either`.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| except FileNotFoundError: | ||
| print(f"Error: File not found: {normalized_path}", file=sys.stderr) |
There was a problem hiding this comment.
P2: Misleading error message: after the path.exists() check succeeds, any FileNotFoundError here cannot be from normalized_path - it would come from build_and_write_quality_outputs() (e.g., output directory issues). Consider capturing the exception with as e and using a generic message.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At cli/fixops_sbom.py, line 116:
<comment>Misleading error message: after the `path.exists()` check succeeds, any `FileNotFoundError` here cannot be from `normalized_path` - it would come from `build_and_write_quality_outputs()` (e.g., output directory issues). Consider capturing the exception with `as e` and using a generic message.</comment>
<file context>
@@ -72,20 +73,57 @@ def build_parser() -> argparse.ArgumentParser:
+ build_and_write_quality_outputs(normalized, json_path, html_path)
+ print(f"Wrote quality report to {json_path} and HTML to {html_path}")
+ return 0
+ except FileNotFoundError:
+ print(f"Error: File not found: {normalized_path}", file=sys.stderr)
+ return 1
</file context>
| except FileNotFoundError: | |
| print(f"Error: File not found: {normalized_path}", file=sys.stderr) | |
| except FileNotFoundError as e: | |
| print(f"Error: File not found: {e}", file=sys.stderr) |
| { | ||
| "pattern-either": [ | ||
| {"pattern": f"$X({func})" for func in pattern.vulnerable_functions} | ||
| { |
There was a problem hiding this comment.
P1: Dict comprehension overwrites the 'pattern' key on each iteration, keeping only the last function. This should be a list comprehension to generate multiple pattern dictionaries for pattern-either.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At risk/reachability/code_analysis.py, line 427:
<comment>Dict comprehension overwrites the 'pattern' key on each iteration, keeping only the last function. This should be a list comprehension to generate multiple pattern dictionaries for `pattern-either`.</comment>
<file context>
@@ -416,7 +424,10 @@ def _build_semgrep_rules(
{
"pattern-either": [
- {"pattern": f"$X({func})" for func in pattern.vulnerable_functions}
+ {
+ "pattern": f"$X({func})"
+ for func in pattern.vulnerable_functions
</file context>
Summary by cubic
Consolidates fixes from PRs #191 and #192 to resolve PR #185 issues, strengthen SBOM CLI/normalizer error handling, and fix CI failures. Also cleans up imports and minor syntax across agents, API, and risk modules, and adds analysis docs.
Bug Fixes
Refactors
Written for commit 62518b2. Summary will update automatically on new commits.