Skip to content

Nondeterministic Reporting file output #133

Description

@mkindalov

Problem

When running liccheck with -R, --reporting option, file is generated.
In cases when multiple licences apply to a package, the licence displayed in the file is nondeterministic.

Why we need deterministic behaviour:

We would like to generate a report with a pre-commit to keep updated licences information in our source code. Nondeterministic behaviour is preventing this from working reliably.

Analysis

The issue is in this line in the process function:

"license": (p["licenses"] or ["UNKNOWN"])[0],

The easiest way to make it deterministic is:
"license": sorted(p["licenses"] or ["UNKNOWN"])[0],

Even better is to show the full list:
"license": " | ".join(sorted(p["licenses"]) or ["UNKNOWN"]),

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions