Skip to content

Commit 0b8aac5

Browse files
committed
fix errors
1 parent cec1d69 commit 0b8aac5

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

avlos/templates/docs.rst.jinja

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
.. _api-reference:
3-
41
API REFERENCE
52
=============
63

avlos/validation.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
Validates C identifiers, detects conflicts, and ensures consistency.
44
"""
55

6+
import logging
67
import re
78
from typing import List
89

10+
_logger = logging.getLogger("avlos")
11+
912
# C reserved words (C11 standard)
1013
C_RESERVED_WORDS = {
1114
"auto",
@@ -86,9 +89,11 @@ def validate_c_identifier(name: str, context: str = "") -> None:
8689
if len(name) > 63:
8790
# C99 requires at least 63 significant characters for identifiers
8891
ctx = f" ({context})" if context else ""
89-
print(
90-
f"Warning: Identifier '{name}'{ctx} is very long ({len(name)} chars). "
91-
f"Some compilers may truncate after 63 characters."
92+
_logger.warning(
93+
"Identifier '%s'%s is very long (%d chars). " "Some compilers may truncate after 63 characters.",
94+
name,
95+
ctx,
96+
len(name),
9297
)
9398

9499

docs/config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ The output config defines the output modules that will be used and their options
7575
There are three main generated files that are configured above: A header containing enums (`output_enums`), a header containing function declarations (`output_header`), and an implementation containing function definitions (`output_impl`).
7676

7777
Optional: Endpoint metadata (for type-aware UART/ASCII parsing)
78-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
78+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7979

8080
If you want the C generator to emit an endpoint type metadata table (so firmware can parse and format ASCII without a hand-maintained table), add both of these optional paths under ``paths``:
8181

tests/test_validation.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ def test_long_identifier_warning(self):
8282
"""Test that very long identifiers generate warnings."""
8383
# 64+ character identifier (C99 requires at least 63 significant chars)
8484
long_name = "a" * 70
85-
# Should not raise, but might print warning
86-
validate_c_identifier(long_name)
85+
# Should not raise; warning is logged (captured here so it does not print)
86+
with self.assertLogs("avlos", level="WARNING") as cm:
87+
validate_c_identifier(long_name)
88+
self.assertIn("very long", cm.output[0])
89+
self.assertIn("63 characters", cm.output[0])
8790

8891
def test_valid_device_passes_all_validation(self):
8992
"""Test that good_device.yaml passes all validations."""

0 commit comments

Comments
 (0)