Skip to content

Commit

Permalink
Changes after mmatuska's review
Browse files Browse the repository at this point in the history
- Use FMT_LIST_SEPARATOR
  • Loading branch information
fernflower committed Jan 11, 2024
1 parent c78774d commit 6d9be1a
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@
from leapp.libraries.stdlib import api
from leapp.models import CustomModifications

FMT_LIST_SEPARATOR = "\n - "


def _create_report(msgs, report_type, component=None, hint=None):
filtered_msgs = [m for m in msgs or [] if m.type == report_type and (not component or m.component == component)]
if not filtered_msgs:
# Nothing to report
return
discovered_files = '\n'.join(
['- {filename}{actor}'.format(filename=m.filename,
actor=' ({} Actor)'.format(m.actor_name) if m.actor_name else '')
discovered_files = ''.join(
['{sep}{filename}{actor}'.format(sep=FMT_LIST_SEPARATOR,
filename=m.filename,
actor=' ({} Actor)'.format(m.actor_name) if m.actor_name else '')
for m in filtered_msgs])
component_str = 'leapp {}'.format(component) if component else 'leapp'
title = '{report_type} files were discovered on the system in {component_str} directories'
summary = ('Apparently some {report_type} files have been found in {component_str} installation directories.\n'
'Please consult the list of discovered files for more information:\n'
'Please consult the list of discovered files for more information:'
'{discovered_files}')
report_parts = [
reporting.Title(title.format(report_type=report_type.capitalize(), component_str=component_str)),
Expand Down

0 comments on commit 6d9be1a

Please sign in to comment.