Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions codewiki/src/be/dependency_analyzer/analysis/cloning.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def clone_repository(github_url: str) -> str:
capture_output=True,
text=True,
)
except:
pass
except (OSError, subprocess.SubprocessError) as e:
logger.debug(f"Failed to set git core.longpaths on Windows: {e}")

subprocess.run(
[
Comment on lines 106 to 113

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 Bare except clauses in clone_repository silently swallow git config failures on Windows, hiding real errors

In clone_repository (codewiki/src/be/dependency_analyzer/analysis/cloning.py), replaced both bare except: clauses (one around the git config core.longpaths call, one around the sparse-checkout config/read-tree block) with except (OSError, subprocess.SubprocessError) as e: combined with logger.debug(...) calls that log the caught exception. This preserves the existing non-fatal behavior for expected Windows edge cases while making unexpected failures visible via debug logging, and no longer masks unrelated exceptions like KeyboardInterrupt/SystemExit since those are not subclasses of OSError or subprocess.SubprocessError.

🤖 Prompt for AI agents
In codewiki/src/be/dependency_analyzer/analysis/cloning.py around line 96, review and complete this code-review fix: Bare except clauses in clone_repository silently swallow git config failures on Windows, hiding real errors.
What the draft fix changed: In `clone_repository` (codewiki/src/be/dependency_analyzer/analysis/cloning.py), replaced both bare `except:` clauses (one around the `git config core.longpaths` call, one around the sparse-checkout config/read-tree block) with `except (OSError, subprocess.SubprocessError) as e:` combined with `logger.debug(...)` calls that log the caught exception. This preserves the existing non-fatal behavior for expected Windows edge cases while making unexpected failures visible via debug logging, and no longer masks unrelated exceptions like `KeyboardInterrupt`/`SystemExit` since those are not subclasses of `OSError` or `subprocess.SubprocessError`.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 85 medium — react 👍/👎 to teach the reviewer

Expand Down Expand Up @@ -158,8 +158,8 @@ def clone_repository(github_url: str) -> str:
capture_output=True,
text=True,
)
except:
pass
except (OSError, subprocess.SubprocessError) as e:
logger.debug(f"Failed to configure sparse-checkout on Windows: {e}")
return temp_dir
except subprocess.TimeoutExpired:
if os.path.exists(temp_dir):
Expand Down