Skip to content

feat: drop regex support for links in metamodel#598

Merged
MaximilianSoerenPollak merged 3 commits into
eclipse-score:mainfrom
etas-contrib:noregex
Jun 15, 2026
Merged

feat: drop regex support for links in metamodel#598
MaximilianSoerenPollak merged 3 commits into
eclipse-score:mainfrom
etas-contrib:noregex

Conversation

@AlexanderLanin

Copy link
Copy Markdown
Member

simplify the code and the metamodel

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //src:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: c5eda4f0-88be-4673-acaf-e46374a9b5b2
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
WARNING: Target pattern parsing failed.
ERROR: Skipping '//src:license-check': no such target '//src:license-check': target 'license-check' not declared in package 'src' defined by /home/runner/work/docs-as-code/docs-as-code/src/BUILD
ERROR: no such target '//src:license-check': target 'license-check' not declared in package 'src' defined by /home/runner/work/docs-as-code/docs-as-code/src/BUILD
INFO: Elapsed time: 6.895s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

@github-actions

Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

@MaximilianSoerenPollak MaximilianSoerenPollak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions

if value.startswith("^"):
return value
return f"^{value}__"
assert isinstance(value, dict), f"Expected dict for ScoreNeedType, got {value}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you not do is instance to make sure it's actually a ScoreNeedType?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, isinstance does not work with TypedDict. As the type info is not a real type AFAIK.

mandatory: bool,
treat_as_info: bool = False,
):
assert attributes_to_allowed_values is not None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda an antipattern no?
If the typehint is allowed to be None, but here you assert that it should never happen?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah... its not pretty. This avoid checking the argument on all call sites, which would be even uglier.

"<": operator.lt,
">=": operator.ge,
"<=": operator.le,
"contains": lambda a, b: b in a if isinstance(a, str) else False,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This then allows for b to be a non string type. Is that wanted behaviour?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, but I did not figure out how to say "else fail horribly" - without changing how the function is designed.


.. std_req:: ASPICE 40 IIC requirement
:id: std_req__aspice_40__iic_1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhh idk if this will work?

As a 1 line seperation might interpret it as content for the need.
Though unsure about that, has been a while.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesnt matter, as next line is a comment. Whether its a comment, real content, or need content. dont care.

need_type["optional_links"],
# "mandatory_links_str" is used to keep only metamodel sourced types. That key is so
# specific, that noone but our metamodel should be using it.
all_need_types = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this all_need_types? It reads like a filtered version already.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's "all our types" aka "all types from metamodel"

status: ^(valid|draft)$
optional_links:
complies: std_wp, ^std_req__aspice_40__iic.*$
# FIXME: only ^std_req__aspice_40__iic.*$

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXME Still needed? THis is now implemented with the graph check no?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed from fixme to simple comment referring to graph check


# At parse time these are None, as they need to be filled post-parsing when all types are available to resolve the link targets.
# The dict maps the link name to a list of need types that are allowed as targets for that link.
mandatory_links: None | dict[str, list[ScoreNeedType]]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default them to None ? Or is that automatic?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately there is no default in TypedDict. All call sites adapted.

@MaximilianSoerenPollak MaximilianSoerenPollak merged commit 11ab363 into eclipse-score:main Jun 15, 2026
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants