From a81dcb20dc65b943569ca252fbd51f0993f57e2c Mon Sep 17 00:00:00 2001 From: PhilipPartsch <95444300+PhilipPartsch@users.noreply.github.com> Date: Tue, 27 Aug 2024 09:15:13 +0200 Subject: [PATCH 01/17] added test case --- tests/doc_test/doc_needs_warnings/conf.py | 16 ++++++++++++++++ tests/doc_test/doc_needs_warnings/index.rst | 9 +++++++++ 2 files changed, 25 insertions(+) diff --git a/tests/doc_test/doc_needs_warnings/conf.py b/tests/doc_test/doc_needs_warnings/conf.py index 1856456a7..515f285e8 100644 --- a/tests/doc_test/doc_needs_warnings/conf.py +++ b/tests/doc_test/doc_needs_warnings/conf.py @@ -59,6 +59,22 @@ def custom_warning_func(need, log): return need["status"] == "example_3" +def custom_warning_multi_needs(need, log, needs): + # need is closed, but linked need is still open. + # This is not allowed by this rule. + return_code: bool = False + if need.status in ['closed', 'done',]: + if len(links) > 0: + for linked_need in links: + if needs[linked_need].status in ['open',]: + return_code = True + + return return_code + + + return need["status"] == "example_3" + + def setup(app): from sphinx_needs.api.configuration import add_warning diff --git a/tests/doc_test/doc_needs_warnings/index.rst b/tests/doc_test/doc_needs_warnings/index.rst index be6596232..66edcd691 100644 --- a/tests/doc_test/doc_needs_warnings/index.rst +++ b/tests/doc_test/doc_needs_warnings/index.rst @@ -27,3 +27,12 @@ TEST DOCUMENT NEEDS WARNINGS .. test:: Test example 3 :id: TC_003 :status: example_3 + +.. test:: Multi needs 1 + :id: TC_MULTI1 + :status: open + +.. test:: Multi needs 2 + :id: TC_MULTI2 + :status: closed + :link: TC_MULTI1 From 18cc8f0c4852a93abd95ce731831a2ee6e0318f3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 07:19:52 +0000 Subject: [PATCH 02/17] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/doc_test/doc_needs_warnings/conf.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/doc_test/doc_needs_warnings/conf.py b/tests/doc_test/doc_needs_warnings/conf.py index 515f285e8..9f9c9038f 100644 --- a/tests/doc_test/doc_needs_warnings/conf.py +++ b/tests/doc_test/doc_needs_warnings/conf.py @@ -63,14 +63,18 @@ def custom_warning_multi_needs(need, log, needs): # need is closed, but linked need is still open. # This is not allowed by this rule. return_code: bool = False - if need.status in ['closed', 'done',]: + if need.status in [ + "closed", + "done", + ]: if len(links) > 0: for linked_need in links: - if needs[linked_need].status in ['open',]: + if needs[linked_need].status in [ + "open", + ]: return_code = True - - return return_code + return return_code return need["status"] == "example_3" From 725370b4e1cb88fce6708cfbb7bfcacc8ed12541 Mon Sep 17 00:00:00 2001 From: PhilipPartsch <95444300+PhilipPartsch@users.noreply.github.com> Date: Tue, 27 Aug 2024 09:51:58 +0200 Subject: [PATCH 03/17] fixed existing tests to cover new test data --- tests/doc_test/doc_needs_warnings/conf.py | 17 +++++++++++++---- tests/doc_test/doc_needs_warnings/index.rst | 2 +- tests/test_needs_warning.py | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/doc_test/doc_needs_warnings/conf.py b/tests/doc_test/doc_needs_warnings/conf.py index 9f9c9038f..3d08a9dde 100644 --- a/tests/doc_test/doc_needs_warnings/conf.py +++ b/tests/doc_test/doc_needs_warnings/conf.py @@ -33,6 +33,14 @@ }, ] +needs_extra_links = [ + { + "option": "depend", + "incoming": "depended", + "outgoing": "depends on", + }, +] + needs_external_needs = [ { "base_url": "http://my_company.com/docs/v1/", @@ -67,10 +75,11 @@ def custom_warning_multi_needs(need, log, needs): "closed", "done", ]: - if len(links) > 0: - for linked_need in links: - if needs[linked_need].status in [ - "open", + if len(depend) > 0: + for linked_need in depend: + if needs[linked_need].status not in [ + "closed", + "done", ]: return_code = True diff --git a/tests/doc_test/doc_needs_warnings/index.rst b/tests/doc_test/doc_needs_warnings/index.rst index 66edcd691..1718f8977 100644 --- a/tests/doc_test/doc_needs_warnings/index.rst +++ b/tests/doc_test/doc_needs_warnings/index.rst @@ -35,4 +35,4 @@ TEST DOCUMENT NEEDS WARNINGS .. test:: Multi needs 2 :id: TC_MULTI2 :status: closed - :link: TC_MULTI1 + :depend: TC_MULTI1 diff --git a/tests/test_needs_warning.py b/tests/test_needs_warning.py index 866d9bab1..983697339 100644 --- a/tests/test_needs_warning.py +++ b/tests/test_needs_warning.py @@ -28,7 +28,7 @@ def test_needs_warnings(test_app): ) # check needs warning from custom defined filter code - assert "failed needs: 1 (TC_001)" in warnings + assert "failed needs: 2 (TC_001, TC_MULTI1)" in warnings assert "used filter: my_custom_warning_check" in warnings # negative test to check needs warning if need passed the warnings-check From dadf9e3d52245a013469329c54e1879a88992c7b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 07:52:13 +0000 Subject: [PATCH 04/17] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/doc_test/doc_needs_warnings/conf.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/doc_test/doc_needs_warnings/conf.py b/tests/doc_test/doc_needs_warnings/conf.py index 3d08a9dde..9ba5266cc 100644 --- a/tests/doc_test/doc_needs_warnings/conf.py +++ b/tests/doc_test/doc_needs_warnings/conf.py @@ -34,11 +34,11 @@ ] needs_extra_links = [ - { - "option": "depend", - "incoming": "depended", - "outgoing": "depends on", - }, + { + "option": "depend", + "incoming": "depended", + "outgoing": "depends on", + }, ] needs_external_needs = [ From eb1f9166fbd5ddd8ff2799dd6aea04a86fd9bcb2 Mon Sep 17 00:00:00 2001 From: PhilipPartsch <95444300+PhilipPartsch@users.noreply.github.com> Date: Tue, 27 Aug 2024 10:05:37 +0200 Subject: [PATCH 05/17] enable new warning with use of all needs --- tests/doc_test/doc_needs_warnings/conf.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/doc_test/doc_needs_warnings/conf.py b/tests/doc_test/doc_needs_warnings/conf.py index 9ba5266cc..f2cc14206 100644 --- a/tests/doc_test/doc_needs_warnings/conf.py +++ b/tests/doc_test/doc_needs_warnings/conf.py @@ -71,13 +71,13 @@ def custom_warning_multi_needs(need, log, needs): # need is closed, but linked need is still open. # This is not allowed by this rule. return_code: bool = False - if need.status in [ + if need["status"] in [ "closed", "done", ]: - if len(depend) > 0: - for linked_need in depend: - if needs[linked_need].status not in [ + if len(need['depend']) > 0: + for linked_need in need['depend']: + if needs[linked_need]["status"] not in [ "closed", "done", ]: @@ -85,8 +85,6 @@ def custom_warning_multi_needs(need, log, needs): return return_code - return need["status"] == "example_3" - def setup(app): from sphinx_needs.api.configuration import add_warning @@ -98,6 +96,7 @@ def setup(app): "invalid_status", "status not in ['open', 'closed', 'done', 'example_2', 'example_3']", ) + add_warning(app, "custom_warning_multi_needs", custom_warning_multi_needs) # Needs option to set True or False to raise sphinx-warning for each not passed warning check From 84b3f3eaa0164effea87286b44306151c8e5f882 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 08:05:53 +0000 Subject: [PATCH 06/17] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/doc_test/doc_needs_warnings/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/doc_test/doc_needs_warnings/conf.py b/tests/doc_test/doc_needs_warnings/conf.py index f2cc14206..fdd4a9884 100644 --- a/tests/doc_test/doc_needs_warnings/conf.py +++ b/tests/doc_test/doc_needs_warnings/conf.py @@ -75,8 +75,8 @@ def custom_warning_multi_needs(need, log, needs): "closed", "done", ]: - if len(need['depend']) > 0: - for linked_need in need['depend']: + if len(need["depend"]) > 0: + for linked_need in need["depend"]: if needs[linked_need]["status"] not in [ "closed", "done", From dfc88e6ce72154a9d607bc87d122f742d40b6eea Mon Sep 17 00:00:00 2001 From: PhilipPartsch <95444300+PhilipPartsch@users.noreply.github.com> Date: Tue, 27 Aug 2024 11:10:11 +0200 Subject: [PATCH 07/17] change process_warnings to support all needs as parameter --- sphinx_needs/warnings.py | 10 ++++++++-- tests/test_needs_warning.py | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/sphinx_needs/warnings.py b/sphinx_needs/warnings.py index 94346f3b9..54aca6b6c 100644 --- a/sphinx_needs/warnings.py +++ b/sphinx_needs/warnings.py @@ -4,6 +4,7 @@ """ from __future__ import annotations +from inspect import signature from sphinx.application import Sphinx from sphinx.util import logging @@ -71,8 +72,13 @@ def process_warnings(app: Sphinx, exception: Exception | None) -> None: # custom defined filter code used from conf.py result = [] for need in checked_needs.values(): - if warning_filter(need, logger): - result.append(need) + sig = signature(warning_filter) + if 3 <= len(sig.parameters): + if warning_filter(need, logger, needs): + result.append(need) + else: + if warning_filter(need, logger): + result.append(need) else: log_warning(logger, f"Unknown needs warnings filter {warning_filter}!") diff --git a/tests/test_needs_warning.py b/tests/test_needs_warning.py index 983697339..d4df39e44 100644 --- a/tests/test_needs_warning.py +++ b/tests/test_needs_warning.py @@ -41,6 +41,10 @@ def test_needs_warnings(test_app): # Check warnings not including external needs assert "EXT_TEST_01" not in warnings + # Check Needs warning with use of all needs + assert "WARNING: custom_warning_multi_needs: failed" in warnings + assert "failed needs: 1 (TC_MULTI)" in warnings + @pytest.mark.parametrize( "test_app", From 327ded77086638f2743ec0a58af87e6881e3b64b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 09:10:39 +0000 Subject: [PATCH 08/17] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- sphinx_needs/warnings.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sphinx_needs/warnings.py b/sphinx_needs/warnings.py index 54aca6b6c..baf4816ce 100644 --- a/sphinx_needs/warnings.py +++ b/sphinx_needs/warnings.py @@ -4,6 +4,7 @@ """ from __future__ import annotations + from inspect import signature from sphinx.application import Sphinx @@ -73,7 +74,7 @@ def process_warnings(app: Sphinx, exception: Exception | None) -> None: result = [] for need in checked_needs.values(): sig = signature(warning_filter) - if 3 <= len(sig.parameters): + if len(sig.parameters) >= 3: if warning_filter(need, logger, needs): result.append(need) else: From fadf1ca557b72f0cc4a22a1661681f1073dda35c Mon Sep 17 00:00:00 2001 From: PhilipPartsch <95444300+PhilipPartsch@users.noreply.github.com> Date: Tue, 27 Aug 2024 13:44:23 +0200 Subject: [PATCH 09/17] enhance documentation --- docs/configuration.rst | 87 ++++++++++++++++------- tests/doc_test/doc_needs_warnings/conf.py | 15 ++-- tests/test_needs_warning.py | 4 +- 3 files changed, 72 insertions(+), 34 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 7d0f0f8c3..35e5f6aa7 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -30,7 +30,7 @@ This would allow Sphinx to perform incremental builds which are much faster as c # conf.py # Defining one or more functions in conf.py is fine - def my_custom_warning(need, log): + def my_custom_warning(need, log, needs): # some checks return False @@ -1331,30 +1331,64 @@ This will handle **all warnings** as exceptions. .. code-block:: python + # conf.py + + # Defining one or more functions in conf.py is fine def my_custom_warning_check(need, log): if need["status"] == "open": log.info(f"{need['id']} status must not be 'open'.") return True return False + def custom_warning_multi_needs(need, log, needs): + # need is closed, but linked need is still open. + # This is not allowed by this rule. + return_code: bool = False + if need["status"] in [ + "closed", + "done", + ]: + for linked_need in need["depend"]: + if needs[linked_need]["status"] not in [ + "closed", + "done", + ]: + return_code = True + + return return_code needs_warnings = { - # req need must not have an empty status field - 'req_with_no_status': "type == 'req' and not status", + # req need must not have an empty status field + 'req_with_no_status': "type == 'req' and not status", - # status must be open or closed - 'invalid_status' : "status not in ['open', 'closed']", + # status must be open or closed + 'invalid_status' : "status not in ['open', 'closed']", - # user defined filter code function - 'type_match': my_custom_warning_check, + # This assignment will deactivate incremental build support inside Sphinx and + # can create an unpickable configuration warning. + # user defined filter code function + 'type_match': my_custom_warning_check, } + # Better, register all warnings via Sphinx-Needs API. In all cases avoid to double definition of filters. + from sphinx_needs.api.configuration import add_warning + def setup(app): + #add_warning(app, "req_with_no_status", "type == 'req' and not status" + #add_warning(app, "invalid_status", "status not in ['open', 'closed']" + #add_warning(app, "type_match", my_custom_warning_check + add_warning(app, "depend_need_not_closed", custom_warning_multi_needs) + ``needs_warnings`` must be a dictionary. The **dictionary key** is used as identifier and gets printed in log outputs. The **value** must be a valid filter string or a custom defined filter code function and defines a *not allowed behavior*. So use the filter string or filter code function to define how needs are not allowed to be configured/used. -The defined filter code function must return ``True`` or ``False``. +The defined filter string and filter code function must return: + +* ``True`` - Warning shall be raised +* ``False`` - No warning needed + + .. warning:: @@ -1365,22 +1399,27 @@ Example output: .. code-block:: text - ... - looking for now-outdated files... none found - pickling environment... done - checking consistency... WARNING: Sphinx-Needs warnings were raised. See console / log output for details. - - Checking Sphinx-Needs warnings - type_check: passed - invalid_status: failed - failed needs: 11 (STYLE_005, EX_ROW_1, EX_ROW_3, copy_2, clv_1, clv_2, clv_3, clv_4, clv_5, T_C3893, R_AD4A0) - used filter: status not in ["open", "in progress", "closed", "done"] and status is not None - - type_match: failed - failed needs: 1 (TC_001) - used filter: - done - ... + ... + looking for now-outdated files... none found + pickling environment... done + checking consistency... WARNING: Sphinx-Needs warnings were raised. See console / log output for details. + + Checking Sphinx-Needs warnings + type_check: passed + invalid_status: failed + failed needs: 11 (STYLE_005, EX_ROW_1, EX_ROW_3, copy_2, clv_1, clv_2, clv_3, clv_4, clv_5, T_C3893, R_AD4A0) + used filter: status not in ["open", "in progress", "closed", "done"] and status is not None + + type_match: failed + failed needs: 1 (TC_001) + used filter: + + depend_need_not_closed: failed + failed needs: 1 (TC_MULTI2) + used filter: + + done + ... Due to the nature of Sphinx logging, a sphinx-warning may be printed wherever in the log. diff --git a/tests/doc_test/doc_needs_warnings/conf.py b/tests/doc_test/doc_needs_warnings/conf.py index fdd4a9884..e240328a5 100644 --- a/tests/doc_test/doc_needs_warnings/conf.py +++ b/tests/doc_test/doc_needs_warnings/conf.py @@ -75,13 +75,12 @@ def custom_warning_multi_needs(need, log, needs): "closed", "done", ]: - if len(need["depend"]) > 0: - for linked_need in need["depend"]: - if needs[linked_need]["status"] not in [ - "closed", - "done", - ]: - return_code = True + for linked_need in need["depend"]: + if needs[linked_need]["status"] not in [ + "closed", + "done", + ]: + return_code = True return return_code @@ -96,7 +95,7 @@ def setup(app): "invalid_status", "status not in ['open', 'closed', 'done', 'example_2', 'example_3']", ) - add_warning(app, "custom_warning_multi_needs", custom_warning_multi_needs) + add_warning(app, "depend_need_not_closed", custom_warning_multi_needs) # Needs option to set True or False to raise sphinx-warning for each not passed warning check diff --git a/tests/test_needs_warning.py b/tests/test_needs_warning.py index d4df39e44..95c144d2d 100644 --- a/tests/test_needs_warning.py +++ b/tests/test_needs_warning.py @@ -42,8 +42,8 @@ def test_needs_warnings(test_app): assert "EXT_TEST_01" not in warnings # Check Needs warning with use of all needs - assert "WARNING: custom_warning_multi_needs: failed" in warnings - assert "failed needs: 1 (TC_MULTI)" in warnings + assert "WARNING: depend_need_not_closed: failed" in warnings + assert "failed needs: 1 (TC_MULTI2)" in warnings @pytest.mark.parametrize( From 608e090eed32a4e2377349243a01f14c4e703d1a Mon Sep 17 00:00:00 2001 From: PhilipPartsch <95444300+PhilipPartsch@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:06:00 +0200 Subject: [PATCH 10/17] changed test_needs_warning.py to cover new created test output --- tests/test_needs_warning.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_needs_warning.py b/tests/test_needs_warning.py index ceee640de..f75e159da 100644 --- a/tests/test_needs_warning.py +++ b/tests/test_needs_warning.py @@ -37,8 +37,11 @@ def test_needs_warnings(test_app): "WARNING: invalid_status: failed", "\t\tfailed needs: 2 (SP_TOO_001, US_63252)", "\t\tused filter: status not in ['open', 'closed', 'done', 'example_2', 'example_3'] [needs.warnings]", + 'WARNING: depend_need_not_closed: failed', + '\t\tfailed needs: 1 (TC_MULTI2)', + '\t\tused filter: custom_warning_multi_needs [needs.warnings]', "WARNING: type_match: failed", - "\t\tfailed needs: 1 (TC_001)", + '\t\tfailed needs: 2 (TC_001, TC_MULTI1)' "\t\tused filter: my_custom_warning_check [needs.warnings]", ] From 84d39a4eed19243da269307fe36d07d1c772faf9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:06:20 +0000 Subject: [PATCH 11/17] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_needs_warning.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_needs_warning.py b/tests/test_needs_warning.py index f75e159da..801d8cb69 100644 --- a/tests/test_needs_warning.py +++ b/tests/test_needs_warning.py @@ -37,11 +37,11 @@ def test_needs_warnings(test_app): "WARNING: invalid_status: failed", "\t\tfailed needs: 2 (SP_TOO_001, US_63252)", "\t\tused filter: status not in ['open', 'closed', 'done', 'example_2', 'example_3'] [needs.warnings]", - 'WARNING: depend_need_not_closed: failed', - '\t\tfailed needs: 1 (TC_MULTI2)', - '\t\tused filter: custom_warning_multi_needs [needs.warnings]', + "WARNING: depend_need_not_closed: failed", + "\t\tfailed needs: 1 (TC_MULTI2)", + "\t\tused filter: custom_warning_multi_needs [needs.warnings]", "WARNING: type_match: failed", - '\t\tfailed needs: 2 (TC_001, TC_MULTI1)' + "\t\tfailed needs: 2 (TC_001, TC_MULTI1)" "\t\tused filter: my_custom_warning_check [needs.warnings]", ] From 0e65ade54f8d6eb44a995d2eab4f6c8141642d0f Mon Sep 17 00:00:00 2001 From: PhilipPartsch <95444300+PhilipPartsch@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:14:38 +0200 Subject: [PATCH 12/17] added test_needs_warning.py missed comma --- tests/test_needs_warning.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_needs_warning.py b/tests/test_needs_warning.py index 801d8cb69..cff69dde1 100644 --- a/tests/test_needs_warning.py +++ b/tests/test_needs_warning.py @@ -41,7 +41,7 @@ def test_needs_warnings(test_app): "\t\tfailed needs: 1 (TC_MULTI2)", "\t\tused filter: custom_warning_multi_needs [needs.warnings]", "WARNING: type_match: failed", - "\t\tfailed needs: 2 (TC_001, TC_MULTI1)" + "\t\tfailed needs: 2 (TC_001, TC_MULTI1)", "\t\tused filter: my_custom_warning_check [needs.warnings]", ] From 9f8ff4c5b45a36a93f4876825a5a689016f8b39a Mon Sep 17 00:00:00 2001 From: PhilipPartsch <95444300+PhilipPartsch@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:28:56 +0200 Subject: [PATCH 13/17] removed test_needs_warning.py wrongly merged lines --- tests/test_needs_warning.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/test_needs_warning.py b/tests/test_needs_warning.py index cff69dde1..342d7f3ce 100644 --- a/tests/test_needs_warning.py +++ b/tests/test_needs_warning.py @@ -58,10 +58,6 @@ def test_needs_warnings(test_app): assert warnings == expected - # Check Needs warning with use of all needs - assert "WARNING: depend_need_not_closed: failed" in warnings - assert "failed needs: 1 (TC_MULTI2)" in warnings - @pytest.mark.parametrize( "test_app", From 2391bcab815b6827b9d07ee393d83fa05f6a6677 Mon Sep 17 00:00:00 2001 From: PhilipPartsch <95444300+PhilipPartsch@users.noreply.github.com> Date: Thu, 17 Oct 2024 19:58:15 +0200 Subject: [PATCH 14/17] Hanlde call-arg for mypy in warnings.py --- sphinx_needs/warnings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx_needs/warnings.py b/sphinx_needs/warnings.py index 2fbee3d9d..e0a59902c 100644 --- a/sphinx_needs/warnings.py +++ b/sphinx_needs/warnings.py @@ -75,7 +75,7 @@ def process_warnings(app: Sphinx, exception: Exception | None) -> None: result = [] for need in needs_view.values(): sig = signature(warning_filter) - if len(sig.parameters) >= 3: + if len(sig.parameters) >= 3: # type: ignore [call-arg] if warning_filter(need, logger, needs_view): result.append(need) else: From 9188455bff703a27f41c1692853f201fc3bbc073 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 17:58:37 +0000 Subject: [PATCH 15/17] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- sphinx_needs/warnings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx_needs/warnings.py b/sphinx_needs/warnings.py index e0a59902c..abcaad16d 100644 --- a/sphinx_needs/warnings.py +++ b/sphinx_needs/warnings.py @@ -75,7 +75,7 @@ def process_warnings(app: Sphinx, exception: Exception | None) -> None: result = [] for need in needs_view.values(): sig = signature(warning_filter) - if len(sig.parameters) >= 3: # type: ignore [call-arg] + if len(sig.parameters) >= 3: # type: ignore [call-arg] if warning_filter(need, logger, needs_view): result.append(need) else: From 41a92662f460e15a11fcc40b0c02b35e5e111124 Mon Sep 17 00:00:00 2001 From: PhilipPartsch <95444300+PhilipPartsch@users.noreply.github.com> Date: Thu, 17 Oct 2024 20:05:52 +0200 Subject: [PATCH 16/17] Update warnings.py --- sphinx_needs/warnings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx_needs/warnings.py b/sphinx_needs/warnings.py index abcaad16d..76b7c9629 100644 --- a/sphinx_needs/warnings.py +++ b/sphinx_needs/warnings.py @@ -75,7 +75,7 @@ def process_warnings(app: Sphinx, exception: Exception | None) -> None: result = [] for need in needs_view.values(): sig = signature(warning_filter) - if len(sig.parameters) >= 3: # type: ignore [call-arg] + if len(sig.parameters) >= 3: # type: ignore[call-arg] if warning_filter(need, logger, needs_view): result.append(need) else: From 9e902b87fe94e80783a314aa424b0e61a9f35722 Mon Sep 17 00:00:00 2001 From: PhilipPartsch <95444300+PhilipPartsch@users.noreply.github.com> Date: Thu, 17 Oct 2024 20:12:40 +0200 Subject: [PATCH 17/17] Update warnings.py fixed mypy postition --- sphinx_needs/warnings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx_needs/warnings.py b/sphinx_needs/warnings.py index 76b7c9629..afc2a3881 100644 --- a/sphinx_needs/warnings.py +++ b/sphinx_needs/warnings.py @@ -75,8 +75,8 @@ def process_warnings(app: Sphinx, exception: Exception | None) -> None: result = [] for need in needs_view.values(): sig = signature(warning_filter) - if len(sig.parameters) >= 3: # type: ignore[call-arg] - if warning_filter(need, logger, needs_view): + if len(sig.parameters) >= 3: + if warning_filter(need, logger, needs_view): # type: ignore[call-arg] result.append(need) else: if warning_filter(need, logger):