Skip to content

Commit

Permalink
Merge pull request #195 from Res260/fixtypehint
Browse files Browse the repository at this point in the history
Fix type hints in validator code to use SigmaRuleBase instead of Sigm…
  • Loading branch information
thomaspatzke authored Feb 19, 2024
2 parents 271b971 + 4107792 commit a43229d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sigma/validators/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ class SigmaValidationIssue(ABC):

description: ClassVar[str] = "Sigma rule validation issue"
severity: ClassVar[SigmaValidationIssueSeverity]
rules: List[SigmaRule]
rules: List[SigmaRuleBase]

def __post_init__(self):
"""Ensure that self.rules contains a list, even when a single rule was provided."""
if isinstance(self.rules, SigmaRule):
"""Ensure that `self.rules` contains a list, even when a single rule was provided."""
if isinstance(self.rules, SigmaRuleBase):
self.rules = [self.rules]

def __str__(self):
Expand Down Expand Up @@ -75,7 +75,7 @@ def validate(self, rule: SigmaRuleBase) -> List[SigmaValidationIssue]:
"""Implementation of the rule validation.
:param rule: Sigma rule that should be validated.
:type rule: SigmaRule
:type rule: SigmaRuleBase
:return: List of validation issue objects describing.
:rtype: List[SigmaValidationIssue]
"""
Expand Down Expand Up @@ -252,7 +252,7 @@ class SigmaTagValidator(SigmaRuleValidator):
each tag.
"""

def validate(self, rule: SigmaRule) -> List[SigmaValidationIssue]:
def validate(self, rule: SigmaRuleBase) -> List[SigmaValidationIssue]:
super().validate(rule)
return [issue for tag in rule.tags for issue in self.validate_tag(tag)]

Expand Down

0 comments on commit a43229d

Please sign in to comment.