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

need_count throws warning with sphinx-needs 1.0.1 #672

Closed
twodrops opened this issue Aug 20, 2022 · 6 comments
Closed

need_count throws warning with sphinx-needs 1.0.1 #672

twodrops opened this issue Aug 20, 2022 · 6 comments

Comments

@twodrops
Copy link
Collaborator

If a filter with an own needs_extra_option is used within need_count, a warning a thrown. The output is however created correctly. This was not the cases with 0.7.9.

Example:

Number of System Requirements: :need_count:`type=='req-sys'`
Number of ASIL D Requirements: :need_count:`asil=='D'`

Throws

WARNING: Filter asil=='D' not valid: Error: Filter asil=='D' not valid: Error: name 'asil' is not defined

The first filter with type throws no warning.

@haiyangToAI
Copy link
Contributor

Hi @twodrops,

I tried needs_extra_options with need_count, but no warnings are thrown.

In your example above, is the extra option asil defined in needs_extra_options in conf.py, e.g. needs_extra_options=["asil"]?

If so, I need more info to analyze. Could you please provide a minimal example that can reproduce the warning?

@twodrops
Copy link
Collaborator Author

@haiyangToAI That's right asil is a needs_extra_option. I migrated the project from 0.7.9 to 1.0.1 and this warning appeared.
The project is an internal one to which you have access. I will send you the link via email.

Thanks for checking this out.

@haiyangToAI
Copy link
Contributor

haiyangToAI commented Sep 2, 2022

Hi @twodrops,

After analyzing the documents you mentioned, I found the reason why those warnings appear.

First of all, it might seems those warnings are caused by need_count, but it actually has nothing to do with it.

The warnings are legit. From the warning example above, it suggests that the filter string asil=='D' failed the evaluation, because extra option asil is not defined.

This made me wonder why extra option asil is not defined in certain needs. Then I went through the documentation, I found the usage of directive test-file.

test-file is the real issue causing all this. It seems to me, directive test-file doesn't consider needs_extra_options, that's why those extra options are not added into needs introduced by test-file.

I will fix it soon.

@haiyangToAI
Copy link
Contributor

@twodrops
Copy link
Collaborator Author

twodrops commented Sep 2, 2022

@haiyangToAI Thanks for analysing this and finding out the root cause. Also thanks for creating the issue.

@danwos
Copy link
Member

danwos commented Sep 6, 2022

I close this issue as it is no problem for Sphinx-Needs and gets solved here: useblocks/sphinx-test-reports#41

@danwos danwos closed this as completed Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants