summaryrefslogtreecommitdiffstats
path: root/test/test_config.py
blob: 4c4ff5a00863c420e09a91f687c41b8b0b823c17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"""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."