Skip to content

Nondeterministic Reporting file output #133

@mkindalov

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"]),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions