Skip to content

Commit

Permalink
Extend dev validation
Browse files Browse the repository at this point in the history
  • Loading branch information
coignetp committed Jul 28, 2021
1 parent b43d9a9 commit 0b07d19
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def config(ctx, check, sync, verbose):
if repo_choice == 'agent':
checks = ['agent']
else:
checks = process_checks_option(check, source='valid_checks')
checks = process_checks_option(check, source='valid_checks', extend_changed=True)

files_failed = {}
files_warned = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def dep(check, require_base_check_version, min_base_check_version):
* Optionally verify that the `datadog-checks-base` requirement satisfies specific version
"""
failed = False
checks = process_checks_option(check, source='valid_checks')
checks = process_checks_option(check, source='valid_checks', extend_changed=True)
check_dependencies, check_errors = read_check_dependencies(checks)

if check_errors:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def models(ctx, check, sync, verbose):
root = get_root()
community_check = ctx.obj['repo_choice'] not in ('core', 'internal')

checks = process_checks_option(check, source='valid_checks')
checks = process_checks_option(check, source='valid_checks', extend_changed=True)
echo_info(f"Validating data models for {len(checks)} checks ...")

specs_failed = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def readmes(ctx, check):
files_failed = {}
readme_counter = set()

integrations = process_checks_option(check, source='integrations')
integrations = process_checks_option(check, source='integrations', extend_changed=True)

for integration in integrations:
display_queue = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def recommended_monitors(check):
checks, an 'all' or empty `check` value will validate all README files.
"""

checks = process_checks_option(check, source='integrations')
checks = process_checks_option(check, source='integrations', extend_changed=True)
echo_info(f"Validating recommended monitors for {len(checks)} checks ...")

failed_checks = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def saved_views(check):
"""
errors = False

integrations = process_checks_option(check, source='integrations')
integrations = process_checks_option(check, source='integrations', extend_changed=True)
echo_info(f"Validating saved views for {len(integrations)} checks ...")

for integration in integrations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def service_checks(check, sync):
"""

root = get_root()
checks = process_checks_option(check, source='integrations')
checks = process_checks_option(check, source='integrations', extend_changed=True)
echo_info(f"Validating service_checks.json files for {len(checks)} checks ...")

failed_checks = 0
Expand Down
4 changes: 3 additions & 1 deletion datadog_checks_dev/datadog_checks/dev/tooling/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def get_tox_env_python_version(env):
return int(match.group(1))


def process_checks_option(check, source=None, validate=False):
def process_checks_option(check, source=None, validate=False, extend_changed=False):
# provide common function for determining which check to run validations against
# `source` determines which method for gathering valid check, default will use `get_valid_checks`
# `validate` gets applied for specific check names, ensuring the check is included in the default
Expand All @@ -343,6 +343,8 @@ def process_checks_option(check, source=None, validate=False):
choice = sorted(get_valid())
elif check.lower() == 'changed':
choice = sorted(get_changed_directories() & get_valid())
if extend_changed and ('datadog_checks_dev' in choice or 'datadog_checks_base' in choice):
choice = sorted(get_valid())
else:
if validate:
choice = [check] if check in get_valid() else []
Expand Down

0 comments on commit 0b07d19

Please sign in to comment.