Skip to content

Use Literal type for expiry status instead of magic strings #5

Description

@f3rdy

Description

Status strings "expired", "warning", "ok" are used as bare string literals in keys.py and compared in cli.py. Typos would not be caught by mypy.

Proposed Solution

from typing import Literal

ExpiryStatus = Literal["expired", "warning", "ok"]

Use ExpiryStatus in ExpiryWarning.status and all comparisons.

Files

  • src/vaultctl/keys.py (lines 100, 102, 104)
  • src/vaultctl/cli.py (lines 337, 361)

Priority

P2

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions