Skip to content

Commit

Permalink
Merge pull request #227 from melexis/filter_attr_empty
Browse files Browse the repository at this point in the history
Support filtering on attributes with empty value
  • Loading branch information
JasperCraeghs authored Jul 9, 2021
2 parents 2049a14 + 3672ee1 commit 740daaf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions doc/integration_test_report.rst
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@ List all items with ASIL and Draft/Approved attribute
:status: (Draft|Approved)
:asil: (QM|[ABCD])

List all RQT-items with the non_functional attribute
----------------------------------------------------

.. item-list:: All non-functional requirements
:filter: RQT-
:non_functional: ^.{0}$

Item matrix
===========

Expand Down
2 changes: 1 addition & 1 deletion mlx/directives/item_matrix_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def perform_replacement(self, app, collection):
show_intermediate = bool(self['intermediatetitle']) and bool(self['intermediate'])
number_of_columns = max(2, len(self['target']) + 1) + int(show_intermediate)
Rows = namedtuple('Rows', "sorted covered uncovered")
source_ids = collection.get_items(self['source'], self['filter-attributes'])
source_ids = collection.get_items(self['source'], attributes=self['filter-attributes'])
targets_with_ids = []
for target_regex in self['target']:
targets_with_ids.append(collection.get_items(target_regex))
Expand Down
2 changes: 2 additions & 0 deletions mlx/traceable_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ def attributes_match(self, attributes):
bool: True if the given attributes match the item attributes.
'''
for attr in attributes:
if attr not in self.attributes:
return False
if not re.match(attributes[attr], self.get_attribute(attr)):
return False
return True
Expand Down

0 comments on commit 740daaf

Please sign in to comment.