def _filtered_rules()

in src/handlers/ruleset_handler.py [0:0]


    def _filtered_rules(rules: list[Rule], platforms: set[str],
                        categories: set[str], service_sections: set[str],
                        sources: set[str]) -> Generator[Rule, None, None]:
        for rule in rules:
            comment = RuleIndex(rule.comment)
            name = rule.name
            if platforms and (not comment.raw_platform or comment.raw_platform.lower() not in platforms):
                _LOG.debug(f'Skipping rule {name}. Platform does not match')
                continue
            if categories and (not comment.category or comment.category.lower() not in categories):
                _LOG.debug(f'Skipping rule {name}. Category does not match')
                continue
            if service_sections and (not comment.service_section or comment.service_section.lower() not in service_sections):
                _LOG.debug(f'Skipping rule {name}. Service section does not match')
                continue
            if sources and (not comment.source or comment.source.lower() not in sources):
                _LOG.debug(f'Skipping rule {name}. Source does not match')
                continue
            yield rule