Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-126447

Standarize formatting of lists in Leapp reports

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • rhel-8.10
    • leapp
    • None
    • rhel-upgrades
    • 1
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      The inclusion of a formatted list in a report is one of typical actions done in plenty of reports. Yet it is not standardized and each actor is doing so in an own way. In most cases  the reviewers are pointing out that there should be use a specific formatting anyway, so majority of lists have the same formatting in the end. Additionally:

      • This formatting is also wanted oftenly in logs and sometimes in error messages, so it's not limited just to reports. Based on that, we wants to put this function somewhere where it satisfies all these typical usecases and people will not have to guess where it is.
      • We realized that quite often lists in reports are not sorted, which is no ideal if people search for something specific they have to read always the whole list - and even the reading is not so comfortable sometimes. As even during reviews we forget quite often on that fact, it would be better if the function do the sorting automatically, but keeping possibility to disable it if wanted.
      • in some cases the list can be super long and it does not make sense to print list with e.g. 500 items in the report. So the possibility to limit amount of items can be sometimes actually better (letting people know that list is incomplete in the report).
      • and sometimes the use of a different separator is wanted, so it would be nice to be able to change it.

      Based on the team discussion, the function signature looks like this:

      format_list(data, sep=FMT_LIST_SEPARATOR, callback_sort=sorted, limit=0)
      

      Which we believe it's pretty flexible but most of the time the default will serve the purpose we want so the usage will be pretty simple. The function should return string which could be comfortably used in reports, logs, or error msgs. To server various purposes, we decided to implement the function in the standard library, but make it available (reimport) in the reporting library. So the function could be imported into the code from 2 different sources comfortably, like:

      from leapp.reporting import format_list
      from leapp.libraries.stdlib import format_list
      

      Definition of done:

      • implement format_list in leapp framework in the stdlib and make it availabe in the reported library as well
      • update upstream documentation
      • bump minor framework_version in the specfile

              leapp-notifications leapp-notifications
              kkula@redhat.com Karolina Kula
              leapp-notifications leapp-notifications
              RHEL Upgrades QE Team RHEL Upgrades QE Team
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: