Skip to content

feat(nixf-tidy): flag --severity #841

Description

@Malix-Labs

Is your feature request related to a problem? Please describe.

It might be desirable to only output high severity reports

/// The super class for all diagnostics.
/// concret diagnostic types are defined in Diagnostic*.inc
class Diagnostic : public PartialDiagnostic {
public:
/// Each diagnostic contains a severity field,
/// should be "Fatal", "Error" or "Warning"
/// this will affect the eval process.
///
/// "Warning" -- just a warning.
enum Severity {
/// shouldn't eval the code, e.g. parsing error.
DS_Fatal,
/// trigger an error in nix, but we can recover & eval the code.
DS_Error,
/// A warning.
DS_Warning,
/// An information.
DS_Info,
/// A hint. Hints are usually not rendered directly in some editor GUI
/// So this is suitable for liveness analysis results.
/// For example, "unused xxx"
DS_Hint,
};

Currently, nixf-tidy does not have a way to specify the minimum severity to output

Describe the solution you'd like

A flag --severity <SEVERITY> in nixf-tidy to enable it to output reports above a provided security threshold

The <SEVERITY> argument should be a valid enum Severity value :

/// The super class for all diagnostics.
/// concret diagnostic types are defined in Diagnostic*.inc
class Diagnostic : public PartialDiagnostic {
public:
/// Each diagnostic contains a severity field,
/// should be "Fatal", "Error" or "Warning"
/// this will affect the eval process.
///
/// "Warning" -- just a warning.
enum Severity {
/// shouldn't eval the code, e.g. parsing error.
DS_Fatal,
/// trigger an error in nix, but we can recover & eval the code.
DS_Error,
/// A warning.
DS_Warning,
/// An information.
DS_Info,
/// A hint. Hints are usually not rendered directly in some editor GUI
/// So this is suitable for liveness analysis results.
/// For example, "unused xxx"
DS_Hint,
};

To keep backward compatibility and sane defaults, the default <SEVERITY> should be the minimum, which would output every reports (currently, DS_Hint)

Describe alternatives you've considered

No response

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestidea-approvedProposed idea is approved by at least 1 maintainers

    Type

    No type

    Fields

    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