Skip to content

Conversation

@faisal-990
Copy link

Description:
#247 Filter issues by severity

This PR adds a --severity (shorthand -s) flag to the issues list command, allowing users to filter issues by severity directly from the CLI. This improves issue triage by enabling developers to quickly surface high-priority findings without additional post-processing.

Key Changes:

  • Added SeverityArg to IssuesListOptions and wired it to the issues list command with shorthand -s.
  • Implemented filterIssuesBySeverity in utils.go.
    • Supports multiple severity flags (e.g. --severity critical --severity major) using OR semantics.

Validation & Normalization:

  • Validates user input against supported DeepSource severities: CRITICAL, MAJOR, MINOR.
  • Normalizes both user input and API values to uppercase to ensure case-insensitive matching.

Testing:

  • Added unit tests for severity filtering in list_test.go, covering:
    • Single and multiple severity filters
    • Invalid severity input handling
    • Duplicate severity flags
  • Introduced isolated mock data at testdata/dummy/issues_severity.json to avoid coupling with existing fixtures.

This adds the --severity (-s) flag to allow users to filter issues by CRITICAL, MAJOR, or MINOR. Includes input validation and dedicated test data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant