Skip to content

Commit a9effdf

Browse files
committed
chore: apply formatting and typing tweaks in history output and tests
1 parent cb64d7a commit a9effdf

4 files changed

Lines changed: 9 additions & 11 deletions

File tree

pacta/cli/history.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from pacta.cli._io import ensure_repo_root
77
from pacta.cli.exitcodes import EXIT_OK
8+
from pacta.snapshot import Snapshot
89
from pacta.snapshot.store import FsSnapshotStore
910

1011

@@ -117,9 +118,11 @@ def _output_text(
117118
refs_str = f" ({', '.join(refs_list)})" if refs_list else ""
118119

119120
# Output line
120-
print(f"{short_hash} {timestamp} {commit} {branch:<12} "
121-
f"{node_count:>3} nodes {edge_count:>3} edges "
122-
f"{violation_count:>2} violations{refs_str}")
121+
print(
122+
f"{short_hash} {timestamp} {commit} {branch:<12} "
123+
f"{node_count:>3} nodes {edge_count:>3} edges "
124+
f"{violation_count:>2} violations{refs_str}"
125+
)
123126

124127
print()
125128

@@ -160,7 +163,7 @@ def _output_json(
160163
"violation_count": len(snapshot.violations),
161164
"violations_by_severity": violations_by_severity,
162165
}
163-
result["entries"].append(entry)
166+
result["entries"].append(entry) # type: ignore[possibly-missing-attribute]
164167

165168
print(json.dumps(result, indent=2, default=str))
166169

@@ -207,10 +210,7 @@ def export(
207210
"tool_version": meta.tool_version,
208211
"node_count": len(snapshot.nodes),
209212
"edge_count": len(snapshot.edges),
210-
"violations": [
211-
v.to_dict() if hasattr(v, "to_dict") else v
212-
for v in snapshot.violations
213-
],
213+
"violations": [v.to_dict() if hasattr(v, "to_dict") else v for v in snapshot.violations],
214214
}
215215
entries.append(entry)
216216

pacta/snapshot/store.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from pacta.snapshot.jsonutil import dumps_deterministic, load_file
2525
from pacta.snapshot.types import Snapshot, SnapshotRef
2626

27-
2827
# Length of hash prefix used for object filenames
2928
HASH_PREFIX_LENGTH = 8
3029

tests/cli/test_history.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from pathlib import Path
77

88
import pytest
9-
109
from pacta.ir.types import CanonicalId, IRNode, Language, SymbolKind
1110
from pacta.snapshot.builder import DefaultSnapshotBuilder
1211
from pacta.snapshot.store import FsSnapshotStore

tests/snapshot/test_snapshot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ def test_builder_preserves_given_created_at(meta):
252252

253253
def test_store_refs_and_objects(tmp_path: Path):
254254
"""Test the new content-addressed storage with refs."""
255-
from pacta.snapshot.store import FsSnapshotStore
256255
from pacta.snapshot.builder import DefaultSnapshotBuilder
256+
from pacta.snapshot.store import FsSnapshotStore
257257
from pacta.snapshot.types import SnapshotMeta
258258

259259
store = FsSnapshotStore(repo_root=str(tmp_path))

0 commit comments

Comments
 (0)