summaryrefslogtreecommitdiffstats
path: root/test/test_config.py
blob: 51a09b012bf4cae4748ed63586dac33d1f6f4b9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""Tests for config module."""
from ansiblelint.config import PROFILES
from ansiblelint.rules import RulesCollection


def test_profiles(default_rules_collection: RulesCollection) -> None:
    """Test the rules included in profiles are valid."""
    profile_banned_tags = {"opt-in", "experimental"}
    for name, data in PROFILES.items():
        for profile_rule_id in data["rules"]:
            for rule in default_rules_collection.rules:
                if profile_rule_id == rule.id:
                    forbidden_tags = profile_banned_tags & set(rule.tags)
                    assert (
                        not forbidden_tags
                    ), f"Rule {profile_rule_id} from {name} profile cannot use {profile_banned_tags & set(rule.tags)} tag."