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

check filter strings for correctness #942

Closed
r-o-b-e-r-t-o opened this issue Jul 5, 2023 · 2 comments
Closed

check filter strings for correctness #942

r-o-b-e-r-t-o opened this issue Jul 5, 2023 · 2 comments

Comments

@r-o-b-e-r-t-o
Copy link
Contributor

r-o-b-e-r-t-o commented Jul 5, 2023

If strings don't evaluate to a boolean value this leads to unexpected behavior.

Example rst code (notice the erroneous filter strings below):

Doc
===

.. comp:: Component
   :id: C_1

.. req:: requirement 1
   :id: R_1

   Requirement 1

.. req:: requirement 2
   :id: R_2

   Requirement 2

need-extract
------------

.. needextract::
   :filter: "R_1"

need-table
----------

.. needtable::
   :filter: id == "R_1" or "R_2"

With this the rendered output shows an arbitrary number of needs in need-extract and need-table sections.
In a big project this may also lead to error message that don't lead to the root cause and are hard to track down if you have a lot of changes in your git branch.

Error messages look like the following:

src/documentation/<rst_prolog>:5:unknown document:

A better behavior would be to show a clear error message during build and/or the rendered HTML page pointing at the erroneous filter string.

@danwos
Copy link
Member

danwos commented Jul 6, 2023

Maybe we need to check the return value of the used eval() function for the statement.
It must be boolean, otherwise throw an error.

Thought this is already happening, but we need to recheck.

@chrisjsewell
Copy link
Member

fixed in #964

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