Fix zip and subprocess invariants, split oversized UI builders - #131
Merged
Conversation
The Chain-of-Thought review framework reads a file or a pull request and reports what it found; until now nothing in the IDE could reach it. It now sits with the other automation tools: Automation > Code Review reviews the file being edited or a pull request, and the output streams into a run window like any other run. One settings form holds what a review needs -- the inference backend and where it is, the code host, the repository -- and every one of those is handed to the child process as a PRTHINKER_* environment variable. That is deliberate for the keys and the token: a command line is visible in a task manager and lands in logs, and an environment variable does not. The framework installs from source rather than from PyPI, so the install entry asks for its folder once, remembers it, and installs that folder with its runner extras. It needs Python 3.12 or newer, which is a property of the interpreter chosen for running, not of the editor. A file has to be saved before it can be reviewed, and a pull request review needs a repository in the settings; both say so rather than starting a run that could only fail.
- zip() over request/name and node/offset pairs now uses strict=True; both rely on equal-length sequences, so a mismatch silently dropped items. - subprocess.run() calls that inspect returncode themselves now pass check=False explicitly. - Move the S310 suppression onto the Request() call it applies to; the directive sat on the following line and suppressed nothing.
DiagramEditorWidget.__init__ and DiagramPropertyPanel.__init__ each built their whole UI inline (101 and 106 statements); both are now split into per-section builders. tools_menu repeated the same eight-line action block seventeen times and kept a second copy of every widget factory. Tab and dock actions are now driven by tables sharing one _WIDGET_FACTORIES registry, matching the dispatch-table pattern the module already used for docks. Also gives ColorButton a per-instance default colour instead of one QColor built at import time and shared by every instance.
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 78 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Result of a full-project scan (ruff, security checklist, complexity caps).
Correctness
zip()over request/name pairs (har_codegen) and node/offset pairs (diagram_mermaid_parser) now usesstrict=True. Both rely on equal-length sequences; a mismatch previously dropped items silently.ColorButtonbuilt its defaultQColorin the argument default, so one instance was created at import time and shared by every button. It is now per instance.S310suppression indiagram_net_utilssat one line below theRequest()call it was meant to cover, so it suppressed nothing. The URL/redirect validation itself was already correct.Explicitness
subprocess.run()calls that inspectreturncodethemselves now passcheck=Falseexplicitly. No behaviour change.Structure
DiagramEditorWidget.__init__(101 statements) andDiagramPropertyPanel.__init__(106) are split into per-section builders.tools_menurepeated the same eight-line action block seventeen times and held a second copy of every widget factory. Tab and dock actions are now table-driven over one shared_WIDGET_FACTORIESregistry, matching the dispatch-table pattern the module already used for docks. Net -190 lines.Verification
ruff check pybreeze/ exe/ test/cleantools_menuwas diffed against the previous version at runtime: 19 tab actions, 19 dock keys and 43 window attributes match, including menu order, labels, and the widget class and constructor arguments behind every action.Note: this branch also carries
99ef96f, which was already committed locally ondevbut not yet pushed.