Skip to content
Open
Show file tree
Hide file tree
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: 6 additions & 2 deletions features/targets/go/node.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
"""Fixture source modeling a Go AST node for CST/AST refactoring tests."""

from collections.abc import Sequence
from typing import Any, Self


class GoAstNode:
"""Base node type exposing Go AST children, properties, and rewrite metadata."""

# direct access protocol
expr: Self
body: Sequence[Self]
Expand All @@ -15,10 +19,10 @@ class GoAstNode:

@property
def properties(self) -> dict[str, Any]:
"""Return the rewrite metadata (length, offset, name) for this node."""
return {"length": self.length, "offset": self.offset, "name": self.name}

children: list[Self] = []

@property
def children(self) -> list[Self]:
"""Return this node's direct child nodes (expr, body, other)."""
return [self.expr, self.body, self.other]
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ skip_covered = false
line-length = 140
src = ["src", "test", "features"]
extend-exclude = [
"features/targets/invalid.py",
"features/targets/taut/taut_test.py", # legacy fixture source, not real code
"features/targets/go/node.py", # legacy fixture source, not real code
"features/targets/taut/taut_test.py", # legacy example, not real code
"features/targets/invalid.py", # deliberately invalid Python (syntax errors); per docs/developer/
# coding-conventions.md we prefer line-based `# noqa` suppression,
# but invalid-syntax has no rule code so it can't be suppressed
# that way (or via per-file-ignores) — file-level exclusion only
]
force-exclude = true

Expand Down
Loading