Skip to content

Commit

Permalink
Update needs.py
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Oct 27, 2024
1 parent 8555397 commit 63c64f1
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions sphinx_needs/needs.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,12 @@ def load_config(app: Sphinx, *_args: Any) -> None:
needs_config = NeedsSphinxConfig(app.config)

if isinstance(needs_config._extra_options, dict):
LOGGER.info(
log_warning(

Check warning on line 414 in sphinx_needs/needs.py

View check run for this annotation

Codecov / codecov/patch

sphinx_needs/needs.py#L414

Added line #L414 was not covered by tests
LOGGER,
'Config option "needs_extra_options" supports list and dict. However new default type since '
"Sphinx-Needs 0.7.2 is list. Please see docs for details."
"Sphinx-Needs 0.7.2 is list. Please see docs for details.",
"config",
None,
)

for option in needs_config._extra_options:
Expand All @@ -424,14 +427,22 @@ def load_config(app: Sphinx, *_args: Any) -> None:
try:
name = option["name"]
except KeyError:
raise NeedsConfigException(
f"Extra option is a dict, but does not contain a 'name' key: {option}"
log_warning(

Check warning on line 430 in sphinx_needs/needs.py

View check run for this annotation

Codecov / codecov/patch

sphinx_needs/needs.py#L429-L430

Added lines #L429 - L430 were not covered by tests
LOGGER,
f"Extra option is a dict, but does not contain a 'name' key: {option}",
"config",
None,
)
continue

Check warning on line 436 in sphinx_needs/needs.py

View check run for this annotation

Codecov / codecov/patch

sphinx_needs/needs.py#L436

Added line #L436 was not covered by tests
description = option.get("description", description)
else:
raise NeedsConfigException(
f"Extra option is not a string or dict: {option}"
log_warning(

Check warning on line 439 in sphinx_needs/needs.py

View check run for this annotation

Codecov / codecov/patch

sphinx_needs/needs.py#L439

Added line #L439 was not covered by tests
LOGGER,
f"Extra option is not a string or dict: {option}",
"config",
None,
)
continue

Check warning on line 445 in sphinx_needs/needs.py

View check run for this annotation

Codecov / codecov/patch

sphinx_needs/needs.py#L445

Added line #L445 was not covered by tests

_NEEDS_CONFIG.add_extra_option(name, description, override=True)

Expand Down

0 comments on commit 63c64f1

Please sign in to comment.