Skip to content
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

Clarify error about incomplete traceability_relationship_to_string #361

Merged
merged 9 commits into from
Oct 27, 2023

Conversation

JasperCraeghs
Copy link
Member

@JasperCraeghs JasperCraeghs commented Oct 26, 2023

When configuration variable traceability_relationship_to_string is incomplete, the doc build is exited with exception: Relationships {'<<relationship_name>>'} are missing from configuration variable 'traceability_relationship_to_string'.

If this is check for completeness were to be removed, a warning would be reported when this relationship is used: Traceability: relation <<relationship_name>> cannot be translated to string. However, this warning is bugged and would crash the doc build with the following error:

Traceback (most recent call last):
  File "/opt/venv/lib/python3.11/site-packages/sphinx/events.py", line 96, in emit
    results.append(listener.handler(self.app, *args))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/mlx/traceability.py", line 249, in process_item_nodes
    node.perform_replacement(app, env.traceability_collection)
  File "/opt/venv/lib/python3.11/site-packages/mlx/directives/item_directive.py", line 28, in perform_replacement
    self._process_relationships(dl_node, app)
  File "/opt/venv/lib/python3.11/site-packages/mlx/directives/item_directive.py", line 65, in _process_relationships
    self._list_targets_for_relation(rel, targets, *args)
  File "/opt/venv/lib/python3.11/site-packages/mlx/directives/item_directive.py", line 84, in _list_targets_for_relation
    env.docname, self.line)
    ^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/sphinx/environment/__init__.py", line 534, in docname
    return self.temp_data['docname']
           ~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'docname'

@Letme
Copy link
Member

Letme commented Oct 26, 2023

Can you add a test case that failed as well?

@JasperCraeghs JasperCraeghs changed the title Fix crash when traceability_relationship_to_string is incomplete Clarify warning message about incomplete traceability_relationship_to_string Oct 27, 2023
@JasperCraeghs JasperCraeghs changed the title Clarify warning message about incomplete traceability_relationship_to_string Clarify error about incomplete traceability_relationship_to_string Oct 27, 2023
@JasperCraeghs
Copy link
Member Author

Can you add a test case that failed as well?

This warning should no longer be used thanks to the error handling I implemented on master branch in May. 76f8270
I added a test case.

@Letme Letme merged commit 4b83986 into master Oct 27, 2023
7 checks passed
@Letme Letme deleted the fix-crash-rel-to-str branch October 27, 2023 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants