Switzerland
Working with teams, changing things and the way we work. Any personal contribution of this user is MIT licensed. Opinions expressed on behalf of himself only.
~sthagen assigned ~sthagen to #8 on ~sthagen/putki
Bug added by ~sthagen on ~sthagen/putki
Ticket created by ~sthagen on ~sthagen/putki
https://git.sr.ht/~sthagen/putki/tree/default/item/putki/traverse.py#L148 spams the logs when target key not present:
2023-11-29T09:45:44.002787+00:00 INFO [PUTKI]: - com-pon-ent: 2023-11-29T09:45:44.003364+00:00 INFO [PUTKI]: + design: Traceback (most recent call last): File "putki", line 8, in sys.exit(app()) File "putki/cli.py", line 170, in verify_structures api.verify_structures(doc_root=doc, structures_name=structures, component=component, options=options) File "putki/api.py", line 42, in verify_structures code, message, root, claims = traverse.follow(structures_name) File "putki/traverse.py", line 148, in follow for facet in structure_info[target]: KeyError: ' com-pon-ent_design'Can we maybe either silence the exception or provide a concise useful information instead?
Proposal:
diff --git a/putki/traverse.py b/putki/traverse.py index 9ddff46..ce8c344 100644 --- a/putki/traverse.py +++ b/putki/traverse.py @@ -145,8 +145,12 @@ def follow(structures_path: Path) -> tuple[int, str, pathlib.Path, dict[str, Any ssp = sub_p.parent / structure_path_str structure_info = load_yaml(ssp) if structure_info: - for facet in structure_info[target]: - validate_facet(facet, ssp) + facets = structure_info.get(target) + if facets is None: + log.warning(f'target ({target}) not found in data - skipping facet validation') + else: + for facet in facets: + validate_facet(facet, ssp) return 0, '', root_path, claims
Comment by ~sthagen on ~sthagen/csaf
Fixed with version 2023.11.27
REPORTED
RESOLVED FIXEDComment by ~sthagen on ~sthagen/csaf
Thank you for reporting the bug (implementation error).
The fix though should not be removing the constraint, but instead implement the correct one (https://docs.oasis-open.org/csaf/csaf/v2.0/os/csaf-v2.0-os.html#321121-document-property---tracking---aliases).
The
min_length
attribute in Pydantic is only valid for strings andaliases
is a list (JSON array) ofAlias
elements.So, I will add a validator "function" instead to the class. Something like:
class Tracking(BaseModel): # ... @classmethod @no_type_check @field_validator('aliases') def check_when_present_not_empty(cls, v): if not v: raise ValueError('optional element if present must not be empty') return v
~sthagen assigned ~sthagen to #56 on ~sthagen/liitos
Bug added by ~sthagen on ~sthagen/liitos
Ticket created by ~sthagen on ~sthagen/liitos
Currently the creation of figure environments from mermaid fenced blocks in markdown source files results in extra empty lines injected into the resulting LaTeX output file.
Example:
\begin{figure} \centering \includegraphics{images/foo-mermaid.png} \caption{Foo \label{fig:foo}} \end{figure}This should really be:
\begin{figure} \centering \includegraphics{images/foo-mermaid.png} \caption{Foo \label{fig:foo}} \end{figure}