How to use the colin.core.ruleset.ruleset.Ruleset function in colin

To help you get started, we’ve selected a few colin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github user-cont / colin / tests / unit / test_ruleset.py View on Github external
def test_ruleset_tags_filtering(tags, expected_check_name):
    r = {
        "version": "1",
        "checks": [
            {
                "name": "name_label"
            }
        ]
    }
    r = Ruleset(ruleset=r)
    checks = r.get_checks(None, tags=tags)
    if expected_check_name:
        assert len(checks) == 1
        assert checks[0].name == expected_check_name
    else:
        assert len(checks) == 0
github user-cont / colin / tests / unit / test_ruleset.py View on Github external
def test_ruleset_override():
    m = "my-message!"
    r = {
        "version": "1",
        "checks": [
            {
                "name": "name_label",
                "tags": ["a", "b"],
                "just": "testing",
                "message": m
            }
        ]
    }
    r = Ruleset(ruleset=r)
    checks = r.get_checks(None)
    assert len(checks) == 1
    assert checks[0].message == m
    assert checks[0].just == "testing"
github user-cont / colin / tests / unit / test_ruleset.py View on Github external
def test_ruleset():
    tests_dir = os.path.dirname(os.path.dirname(__file__))
    lol_ruleset_path = os.path.join(tests_dir, "data", "lol-ruleset.json")
    with open(lol_ruleset_path, "r") as fd:
        r = Ruleset(ruleset_file=fd)
        checks = r.get_checks(None)
    assert len(checks) == 1
github user-cont / colin / tests / unit / test_ruleset.py View on Github external
def test_ruleset_additional_tags():
    tags = ["a"]
    r = {
        "version": "1",
        "checks": [
            {
                "name": "name_label",
                "additional_tags": tags[:]
            }
        ]
    }
    r = Ruleset(ruleset=r)
    checks = r.get_checks(None)
    assert len(checks) == 1
    assert list(set(tags).intersection(set(checks[0].tags))) == tags
github user-cont / colin / tests / unit / test_ruleset.py View on Github external
def test_ruleset_version(version, should_raise):
    if version == "":
        r = {"banana": 123}
    else:
        r = {"version": version}
    if should_raise:
        with pytest.raises(ColinRulesetException):
            Ruleset(ruleset=r)
    else:
        assert Ruleset(ruleset=r)
github user-cont / colin / tests / unit / test_ruleset.py View on Github external
def test_ruleset_tags():
    tags = ["a", "banana"]
    r = {
        "version": "1",
        "checks": [
            {
                "name": "name_label",
                "tags": tags[:]
            }
        ]
    }
    r = Ruleset(ruleset=r)
    checks = r.get_checks(None)
    assert len(checks) == 1
    assert checks[0].tags == tags
github user-cont / colin / colin / core / colin.py View on Github external
def _get_checks(
    target_type,
    tags=None,
    ruleset_name=None,
    ruleset_file=None,
    ruleset=None,
    checks_paths=None,
    skips=None,
):
    ruleset = Ruleset(
        ruleset_name=ruleset_name,
        ruleset_file=ruleset_file,
        ruleset=ruleset,
        checks_paths=checks_paths,
    )
    return ruleset.get_checks(tags=tags, target_type=target_type, skips=skips)