def render_config_spec_progress():
    valid_checks = [
        x for x in sorted(get_valid_checks()) if not is_tile_only(x)
    ]
    total_checks = len(valid_checks)
    checks_with_config_spec = 0

    lines = ['## Config specs', '', None, '', '??? check "Completed"']

    for check in valid_checks:
        config_spec_path = get_default_config_spec(check)
        if os.path.isfile(config_spec_path):
            checks_with_config_spec += 1
            status = 'X'
        else:
            status = ' '

        lines.append(f'    - [{status}] {check}')

    percent = checks_with_config_spec / total_checks * 100
    formatted_percent = f'{percent:.2f}'
    lines[2] = f'[={formatted_percent}% "{formatted_percent}%"]'
    lines[
        4] = f'??? check "Completed {checks_with_config_spec}/{total_checks}"'
    return lines
示例#2
0
def http(check):
    """Validate all integrations for usage of http wrapper."""

    has_failed = False

    checks = process_checks_option(check, source='integrations')
    echo_info(
        f"Validating {len(checks)} integrations for usage of http wrapper...")

    for check in checks:
        check_uses_http_wrapper = False

        # Validate use of http wrapper (self.http.[...]) in check's .py files
        if check not in EXCLUDED_INTEGRATIONS:
            check_uses_http_wrapper = validate_use_http_wrapper(check)

        # Validate use of http template in check's spec.yaml (if exists)
        if check_uses_http_wrapper:
            has_failed = validate_config_http(get_default_config_spec(check),
                                              check) or has_failed

    if has_failed:
        abort()

    echo_success('Completed http validation!')
示例#3
0
def render_config_validation_progress():
    valid_checks = sorted(c for c in get_valid_checks()
                          if os.path.isfile(get_default_config_spec(c)))
    total_checks = len(valid_checks)
    checks_with_config_validation = 0

    lines = ['## Config validation', '', None, '', '??? check "Completed"']

    for check in valid_checks:
        if has_config_models(check):
            status = 'X'
            checks_with_config_validation += 1
        else:
            status = ' '

        lines.append(f'    - [{status}] {check}')

    percent = checks_with_config_validation / total_checks * 100
    formatted_percent = f'{percent:.2f}'
    lines[2] = f'[={formatted_percent}% "{formatted_percent}%"]'
    lines[
        4] = f'??? check "Completed {checks_with_config_validation}/{total_checks}"'
    return lines