[PR #3241] [CLOSED] fix: improve code quality across pipeline and scripts #3302

Closed
opened 2026-06-05 18:22:14 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/3241
Author: @surajsahani
Created: 3/21/2026
Status: Closed

Base: mainHead: fix/code-quality-improvements


📝 Commits (1)

  • 4d7bc25 fix: improve code quality across pipeline and scripts

📊 Changes

3 files changed (+16 additions, -71 deletions)

View changed files

📝 pipeline/cli.py (+1 -1)
📝 pipeline/core/builder.py (+3 -65)
📝 scripts/convert_pip_to_codegroup.py (+12 -5)

📄 Description

Summary

Three targeted code quality fixes:

  1. pipeline/cli.pylogger.exception() was called outside an exception handler in migrate_command(). Replaced with logger.error() since there's no traceback to attach.

  2. scripts/convert_pip_to_codegroup.pyconvert_file() silently swallowed all exceptions (except: pass), and main() produced zero output (including --dry-run being a literal no-op pass). Now reports errors, prints per-file status, and shows a summary.

  3. pipeline/core/builder.py — Deduplicated the file-build logic that was copy-pasted across 4 methods (_build_single_file_to_path, _build_file_with_progress, _build_single_file, _build_version_file_with_progress). The latter 3 now delegate to _build_single_file_to_path, removing ~60 lines of duplicated code.

All 134 existing tests pass. Ruff clean.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/docs/pull/3241 **Author:** [@surajsahani](https://github.com/surajsahani) **Created:** 3/21/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/code-quality-improvements` --- ### 📝 Commits (1) - [`4d7bc25`](https://github.com/langchain-ai/docs/commit/4d7bc2525ec6d29b8cefc18af54a7dca1db6d0b8) fix: improve code quality across pipeline and scripts ### 📊 Changes **3 files changed** (+16 additions, -71 deletions) <details> <summary>View changed files</summary> 📝 `pipeline/cli.py` (+1 -1) 📝 `pipeline/core/builder.py` (+3 -65) 📝 `scripts/convert_pip_to_codegroup.py` (+12 -5) </details> ### 📄 Description ## Summary Three targeted code quality fixes: 1. **pipeline/cli.py** — `logger.exception()` was called outside an exception handler in `migrate_command()`. Replaced with `logger.error()` since there's no traceback to attach. 2. **scripts/convert_pip_to_codegroup.py** — `convert_file()` silently swallowed all exceptions (`except: pass`), and `main()` produced zero output (including `--dry-run` being a literal no-op `pass`). Now reports errors, prints per-file status, and shows a summary. 3. **pipeline/core/builder.py** — Deduplicated the file-build logic that was copy-pasted across 4 methods (`_build_single_file_to_path`, `_build_file_with_progress`, `_build_single_file`, `_build_version_file_with_progress`). The latter 3 now delegate to `_build_single_file_to_path`, removing ~60 lines of duplicated code. All 134 existing tests pass. Ruff clean. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 18:22:14 -04:00
yindo closed this issue 2026-06-05 18:22:14 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#3302