issue 77 pt3 final lints
This commit is contained in:
parent
d5f71f5f01
commit
e7d0fae144
|
|
@ -3,7 +3,7 @@
|
||||||
enums.py
|
enums.py
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum, StrEnum
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
@ -46,7 +46,7 @@ class SafeEnum(sa.Enum):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
class Environment(str, Enum):
|
class Environment(StrEnum):
|
||||||
"""
|
"""
|
||||||
Application environment.
|
Application environment.
|
||||||
"""
|
"""
|
||||||
|
|
@ -55,7 +55,7 @@ class Environment(str, Enum):
|
||||||
PRODUCTION = "production"
|
PRODUCTION = "production"
|
||||||
|
|
||||||
|
|
||||||
class UserRole(str, Enum):
|
class UserRole(StrEnum):
|
||||||
"""
|
"""
|
||||||
User roles for authorization.
|
User roles for authorization.
|
||||||
"""
|
"""
|
||||||
|
|
@ -65,7 +65,7 @@ class UserRole(str, Enum):
|
||||||
ADMIN = "admin"
|
ADMIN = "admin"
|
||||||
|
|
||||||
|
|
||||||
class TokenType(str, Enum):
|
class TokenType(StrEnum):
|
||||||
"""
|
"""
|
||||||
JWT token types.
|
JWT token types.
|
||||||
"""
|
"""
|
||||||
|
|
@ -73,7 +73,7 @@ class TokenType(str, Enum):
|
||||||
REFRESH = "refresh"
|
REFRESH = "refresh"
|
||||||
|
|
||||||
|
|
||||||
class HealthStatus(str, Enum):
|
class HealthStatus(StrEnum):
|
||||||
"""
|
"""
|
||||||
Health check status values.
|
Health check status values.
|
||||||
"""
|
"""
|
||||||
|
|
@ -82,7 +82,7 @@ class HealthStatus(str, Enum):
|
||||||
DEGRADED = "degraded"
|
DEGRADED = "degraded"
|
||||||
|
|
||||||
|
|
||||||
class ProgramStatus(str, Enum):
|
class ProgramStatus(StrEnum):
|
||||||
"""
|
"""
|
||||||
Bug bounty program lifecycle status.
|
Bug bounty program lifecycle status.
|
||||||
"""
|
"""
|
||||||
|
|
@ -92,7 +92,7 @@ class ProgramStatus(str, Enum):
|
||||||
CLOSED = "closed"
|
CLOSED = "closed"
|
||||||
|
|
||||||
|
|
||||||
class ProgramVisibility(str, Enum):
|
class ProgramVisibility(StrEnum):
|
||||||
"""
|
"""
|
||||||
Bug bounty program visibility level.
|
Bug bounty program visibility level.
|
||||||
"""
|
"""
|
||||||
|
|
@ -101,7 +101,7 @@ class ProgramVisibility(str, Enum):
|
||||||
INVITE_ONLY = "invite_only"
|
INVITE_ONLY = "invite_only"
|
||||||
|
|
||||||
|
|
||||||
class AssetType(str, Enum):
|
class AssetType(StrEnum):
|
||||||
"""
|
"""
|
||||||
Type of asset in a bug bounty program scope.
|
Type of asset in a bug bounty program scope.
|
||||||
"""
|
"""
|
||||||
|
|
@ -113,7 +113,7 @@ class AssetType(str, Enum):
|
||||||
OTHER = "other"
|
OTHER = "other"
|
||||||
|
|
||||||
|
|
||||||
class Severity(str, Enum):
|
class Severity(StrEnum):
|
||||||
"""
|
"""
|
||||||
Vulnerability severity levels aligned with CVSS.
|
Vulnerability severity levels aligned with CVSS.
|
||||||
"""
|
"""
|
||||||
|
|
@ -124,7 +124,7 @@ class Severity(str, Enum):
|
||||||
INFORMATIONAL = "informational"
|
INFORMATIONAL = "informational"
|
||||||
|
|
||||||
|
|
||||||
class ReportStatus(str, Enum):
|
class ReportStatus(StrEnum):
|
||||||
"""
|
"""
|
||||||
Vulnerability report lifecycle status.
|
Vulnerability report lifecycle status.
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
Application enums for type safety
|
Application enums for type safety
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from enum import Enum
|
from enum import StrEnum
|
||||||
|
|
||||||
|
|
||||||
class MessageStatus(str, Enum):
|
class MessageStatus(StrEnum):
|
||||||
"""
|
"""
|
||||||
Message delivery status
|
Message delivery status
|
||||||
"""
|
"""
|
||||||
|
|
@ -17,7 +17,7 @@ class MessageStatus(str, Enum):
|
||||||
FAILED = "failed"
|
FAILED = "failed"
|
||||||
|
|
||||||
|
|
||||||
class PresenceStatus(str, Enum):
|
class PresenceStatus(StrEnum):
|
||||||
"""
|
"""
|
||||||
User presence status
|
User presence status
|
||||||
"""
|
"""
|
||||||
|
|
@ -26,7 +26,7 @@ class PresenceStatus(str, Enum):
|
||||||
OFFLINE = "offline"
|
OFFLINE = "offline"
|
||||||
|
|
||||||
|
|
||||||
class RoomType(str, Enum):
|
class RoomType(StrEnum):
|
||||||
"""
|
"""
|
||||||
Chat room types
|
Chat room types
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ func (c *Client) queryBatch(
|
||||||
req.Header.Set("Content-Type", "application/json")
|
req.Header.Set("Content-Type", "application/json")
|
||||||
req.Header.Set("User-Agent", userAgent)
|
req.Header.Set("User-Agent", userAgent)
|
||||||
|
|
||||||
resp, err := c.http.Do(req)
|
resp, err := c.http.Do(req) //nolint:gosec // hardcoded OSV API endpoint
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -191,7 +191,7 @@ func (c *Client) fetchVuln(
|
||||||
}
|
}
|
||||||
req.Header.Set("User-Agent", userAgent)
|
req.Header.Set("User-Agent", userAgent)
|
||||||
|
|
||||||
resp, err := c.http.Do(req)
|
resp, err := c.http.Do(req) //nolint:gosec // hardcoded OSV API endpoint
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,12 +67,12 @@ func (c *Cache) Set(key string, entry *CacheEntry) error {
|
||||||
|
|
||||||
if _, writeErr := tmp.Write(data); writeErr != nil {
|
if _, writeErr := tmp.Write(data); writeErr != nil {
|
||||||
_ = tmp.Close() //nolint:errcheck
|
_ = tmp.Close() //nolint:errcheck
|
||||||
_ = os.Remove(tmp.Name()) //nolint:errcheck
|
_ = os.Remove(tmp.Name()) //nolint:errcheck,gosec
|
||||||
return writeErr
|
return writeErr
|
||||||
}
|
}
|
||||||
_ = tmp.Close() //nolint:errcheck
|
_ = tmp.Close() //nolint:errcheck
|
||||||
|
|
||||||
return os.Rename(tmp.Name(), c.path(key))
|
return os.Rename(tmp.Name(), c.path(key)) //nolint:gosec
|
||||||
}
|
}
|
||||||
|
|
||||||
// Touch refreshes the CachedAt timestamp without changing stored data
|
// Touch refreshes the CachedAt timestamp without changing stored data
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ func (c *Client) doWithRetry(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := c.http.Do(req)
|
resp, err := c.http.Do(req) //nolint:gosec
|
||||||
if err != nil {
|
if err != nil {
|
||||||
lastErr = err
|
lastErr = err
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
Enum definitions for the application for type safety
|
Enum definitions for the application for type safety
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from enum import Enum
|
from enum import StrEnum
|
||||||
|
|
||||||
|
|
||||||
class ScanStatus(str, Enum):
|
class ScanStatus(StrEnum):
|
||||||
"""
|
"""
|
||||||
Enum for scan result status
|
Enum for scan result status
|
||||||
"""
|
"""
|
||||||
|
|
@ -15,7 +15,7 @@ class ScanStatus(str, Enum):
|
||||||
ERROR = "error"
|
ERROR = "error"
|
||||||
|
|
||||||
|
|
||||||
class Severity(str, Enum):
|
class Severity(StrEnum):
|
||||||
"""
|
"""
|
||||||
Enum for vulnerability severity levels
|
Enum for vulnerability severity levels
|
||||||
"""
|
"""
|
||||||
|
|
@ -27,7 +27,7 @@ class Severity(str, Enum):
|
||||||
INFO = "info"
|
INFO = "info"
|
||||||
|
|
||||||
|
|
||||||
class TestType(str, Enum):
|
class TestType(StrEnum):
|
||||||
"""
|
"""
|
||||||
Enum for available security test types
|
Enum for available security test types
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue