-
Notifications
You must be signed in to change notification settings - Fork 37
Add pcb_panelization_placement_warning #435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
seveibar
wants to merge
1
commit into
main
Choose a base branch
from
codex/introduce-pcb_panelization_placement_error-and-warning
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import { z } from "zod" | ||
| import { getZodPrefixedIdWithDefault } from "src/common" | ||
| import { expectTypesMatch } from "src/utils/expect-types-match" | ||
|
|
||
| export const pcb_panelization_placement_warning = z | ||
| .object({ | ||
| type: z.literal("pcb_panelization_placement_warning"), | ||
| pcb_panelization_placement_warning_id: getZodPrefixedIdWithDefault( | ||
| "pcb_panelization_placement_warning", | ||
| ), | ||
| warning_type: z | ||
| .literal("pcb_panelization_placement_warning") | ||
| .default("pcb_panelization_placement_warning"), | ||
| message: z.string(), | ||
| pcb_panel_id: z.string().optional(), | ||
| pcb_board_id: z.string().optional(), | ||
| subcircuit_id: z.string().optional(), | ||
| }) | ||
| .describe("Defines a panelization placement warning on the PCB") | ||
|
|
||
| export type PcbPanelizationPlacementWarningInput = z.input< | ||
| typeof pcb_panelization_placement_warning | ||
| > | ||
| type InferredPcbPanelizationPlacementWarning = z.infer< | ||
| typeof pcb_panelization_placement_warning | ||
| > | ||
|
|
||
| /** | ||
| * Defines a panelization placement warning on the PCB | ||
| */ | ||
| export interface PcbPanelizationPlacementWarning { | ||
| type: "pcb_panelization_placement_warning" | ||
| pcb_panelization_placement_warning_id: string | ||
| warning_type: "pcb_panelization_placement_warning" | ||
| message: string | ||
| pcb_panel_id?: string | ||
| pcb_board_id?: string | ||
| subcircuit_id?: string | ||
| } | ||
|
|
||
| /** | ||
| * @deprecated use PcbPanelizationPlacementWarning | ||
| */ | ||
| export type PCBPanelizationPlacementWarning = PcbPanelizationPlacementWarning | ||
|
|
||
| expectTypesMatch< | ||
| PcbPanelizationPlacementWarning, | ||
| InferredPcbPanelizationPlacementWarning | ||
| >(true) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { test, expect } from "bun:test" | ||
| import { pcb_panelization_placement_warning } from "../src/pcb/pcb_panelization_placement_warning" | ||
| import { any_circuit_element } from "../src/any_circuit_element" | ||
|
|
||
| test("pcb_panelization_placement_warning parses", () => { | ||
| const warning = pcb_panelization_placement_warning.parse({ | ||
| type: "pcb_panelization_placement_warning", | ||
| message: "panelized board placement has minor issues", | ||
| pcb_panel_id: "pcb_panel_1", | ||
| pcb_board_id: "pcb_board_1", | ||
| }) | ||
|
|
||
| expect(warning.pcb_panelization_placement_warning_id).toBeDefined() | ||
| expect( | ||
| warning.pcb_panelization_placement_warning_id.startsWith( | ||
| "pcb_panelization_placement_warning", | ||
| ), | ||
| ).toBe(true) | ||
| expect(warning.pcb_panel_id).toBe("pcb_panel_1") | ||
| expect(warning.pcb_board_id).toBe("pcb_board_1") | ||
| }) | ||
|
|
||
| test("any_circuit_element includes pcb_panelization_placement_warning", () => { | ||
| const parsed = any_circuit_element.parse({ | ||
| type: "pcb_panelization_placement_warning", | ||
| message: "panelized board placement has minor issues", | ||
| }) | ||
|
|
||
| expect(parsed.type).toBe("pcb_panelization_placement_warning") | ||
| }) | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test file contains 2 test() functions (lines 5 and 23), but according to the style guide rule about test file structure, a *.test.ts file may have AT MOST one test(...) function. After that, the user should split into multiple numbered files. To fix this, split the tests into separate files like 'pcb_panelization_placement_warning1.test.ts' and 'pcb_panelization_placement_warning2.test.ts', with each file containing only one test() function.
Spotted by Graphite Agent (based on custom rule: Custom rule)

Is this helpful? React 👍 or 👎 to let us know.