-
Notifications
You must be signed in to change notification settings - Fork 25
PoC feature_in_id for single module repositories
#604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
48f5dc5
d131e62
e28655a
2951d41
f49bf61
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -58,19 +58,36 @@ def id_contains_feature(app: Sphinx, need: NeedItem, log: CheckLogger): | |||||||||||||
| for featurepart in featureparts | ||||||||||||||
| if featureparts and featurepart and docname | ||||||||||||||
| ) | ||||||||||||||
| allowed_parts_from_config = app.config.required_in_id | ||||||||||||||
| found_part_from_config = any( | ||||||||||||||
| part_from_config.lower() in feature.lower() | ||||||||||||||
| for part_from_config in allowed_parts_from_config | ||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AI-assisted review (Claude): The match is against the full need ID (e.g. The check should compare against
Suggested change
|
||||||||||||||
| if allowed_parts_from_config | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| # allow abbreviation of the feature | ||||||||||||||
| initials = ( | ||||||||||||||
| "".join(fp[0].lower() for fp in featureparts) if len(featureparts) > 1 else "" | ||||||||||||||
| ) | ||||||||||||||
| foundinitials = bool(initials) and docname and initials in docname.lower() | ||||||||||||||
| if not (foundfeatpart or foundinitials or found_part_from_config): | ||||||||||||||
| parts_display = ", ".join(f"'{p}'" for p in featureparts) | ||||||||||||||
| config_display = ( | ||||||||||||||
| ", ".join(f"'{p}'" for p in allowed_parts_from_config) | ||||||||||||||
| if allowed_parts_from_config | ||||||||||||||
| else "[]" | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| fix_options = [f"rename the feature part to match a segment of '{docname}'"] | ||||||||||||||
| if initials: | ||||||||||||||
| fix_options.append(f"use correct abbreviation '{initials}'") | ||||||||||||||
| fix_options.append( | ||||||||||||||
| f"Add an allowed part to `required_in_id` in conf.py (currently: {config_display})" | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| if not (foundfeatpart or foundinitials): | ||||||||||||||
| log.warning_for_option( | ||||||||||||||
| need, | ||||||||||||||
| "id", | ||||||||||||||
| ( | ||||||||||||||
| f"Featurepart '{featureparts}' not in path '{docname}' " | ||||||||||||||
| f"or abbreviation not ok, expected: '{initials}'." | ||||||||||||||
| ), | ||||||||||||||
| combined_msg = ( | ||||||||||||||
| f"Feature part {parts_display} not found in path '{docname}'. " | ||||||||||||||
| "\nHow can you fix this:\n=>" | ||||||||||||||
| f"{'\n=> '.join(fix_options)}.\n" | ||||||||||||||
| ) | ||||||||||||||
| log.warning_for_option(need, "id", combined_msg) | ||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ | |
| "sphinx_needs", | ||
| "score_metamodel", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AI-assisted review (Claude): Adding More importantly, this is a globally-permissive sentinel value chosen purely for testing. When reviewing or debugging failures, it's non-obvious why
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a non issue as we only tests single checks in each RST file. |
||
| ] | ||
|
|
||
| required_in_id = ["blabla"] | ||
| needs_external_needs = [ | ||
| { | ||
| "base_url": "https://eclipse-score.github.io/process_description/main/", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,8 +11,10 @@ | |
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| #CHECK: id_contains_feature | ||
|
|
||
|
|
||
| .. Feature is in the path of the RST file | ||
| #EXPECT-NOT[+2]: Feature 'id_contains_feature' not in path | ||
|
|
||
|
|
@@ -34,3 +36,33 @@ | |
|
|
||
| .. stkh_req:: This is a test | ||
| :id: stkh_req__test__abce | ||
|
|
||
|
|
||
|
|
||
| .. Check if feature is correctly found to not be in path | ||
| #EXPECT[+2]: Feature part 'abcabc' not found in path 'id_contains_feature'. | ||
|
|
||
| .. feat_req:: Testing if warning correctly triggers | ||
| :id: feat_req__abcabc__testing | ||
|
|
||
|
|
||
|
|
||
| .. Check if feature is correctly found to be in path | ||
| #EXPECT-NOT[+2]: Feature part | ||
|
|
||
| .. feat_req:: Testing if warning correctly triggers | ||
| :id: feat_req__id_contains__testing | ||
|
|
||
|
|
||
| .. Testing if additional allowed param in conf.py is valid | ||
| #EXPECT-NOT[+2]: Feature part | ||
|
|
||
| .. feat_req:: Testing conf.py parameter | ||
| :id: feat_req__blabla__testing | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AI-assisted review (Claude): This test verifies that Once the match is narrowed to the feature part (see comment on
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems plausible. Will add this. |
||
|
|
||
|
|
||
| .. Testing if additional allowed param in conf.py is valid | ||
| #EXPECT[+2]: Feature part 'abcabcabc' not found in path 'id_contains_feature'. | ||
|
|
||
| .. feat_req:: Testing conf.py parameter | ||
| :id: feat_req__abcabcabc__blabla_testing | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AI-assisted review (Claude):
"persistenc"is a partial string that would matchpersistence,persistency, etc. If this substring match is intentional, it should be explained in the docs β readers will assume it's a typo for"persistence"and either copy it incorrectly or fix it in their ownconf.pywithout understanding why the truncation was used.If the intent is an exact feature name, use the full string. If partial matching is a deliberate affordance, document it explicitly here.