Skip to content

Commit 4c1064d

Browse files
committed
Fix regression
1 parent 7d71647 commit 4c1064d

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

cli/findings_export.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,12 @@ def main() -> None:
373373
key_regexp=params.get(options.KEY_REGEXP, None),
374374
branch_regexp=branch_regexp,
375375
)
376+
if params[options.COMPONENT_TYPE] == "portfolios":
377+
components = []
378+
for comp in components_list:
379+
components += comp.components()
380+
components_list = components
381+
376382
if len(components_list) == 0:
377383
br = f"and branch matching regexp '{params[options.BRANCH_REGEXP]}'" if options.BRANCH_REGEXP in params else ""
378384
raise exceptions.SonarException(

sonar/util/component_helper.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,9 @@ def get_components(
3232
if component_type in ("apps", "applications"):
3333
components = [p for p in applications.get_list(endpoint).values() if re.match(rf"^{key_regexp}$", p.key)]
3434
elif component_type == "portfolios":
35-
portfolio_list = [p for p in portfolios.get_list(endpoint).values() if re.match(rf"^{key_regexp}$", p.key)]
35+
components = [p for p in portfolios.get_list(endpoint).values() if re.match(rf"^{key_regexp}$", p.key)]
3636
if kwargs.get("topLevelOnly", False):
37-
portfolio_list = [p for p in portfolio_list if p.is_toplevel()]
38-
components = []
39-
for comp in portfolio_list:
40-
components += comp.components()
37+
components = [p for p in components if p.is_toplevel()]
4138
else:
4239
components = [p for p in projects.get_list(endpoint).values() if re.match(rf"^{key_regexp}$", p.key)]
4340
if component_type != "portfolios" and branch_regexp:

0 commit comments

Comments
 (0)