Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validation for readmes #7088

Merged
merged 22 commits into from
Jul 24, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix style
  • Loading branch information
sarah-witt committed Jul 9, 2020
commit c5b34935d37504ddb78d17ffe179c661ffcdd645
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
IMAGE_EXTENSIONS = {"png", "jpg"}
NON_TILE_INTEGRATIONS = {"sortdb", "hbase_master", "kube_proxy"}
AlexandreYang marked this conversation as resolved.
Show resolved Hide resolved


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Validate README.md files')
@click.pass_context
@click.argument('integration', autocompletion=complete_valid_checks, required=False)
Expand All @@ -25,7 +26,7 @@ def readmes(ctx, integration):

errors = False
integrations = []

if integration:
integrations = [integration]
else:
Expand All @@ -37,10 +38,10 @@ def readmes(ctx, integration):

lines = read_readme_file(integration)
for line_no, line in lines:

if "## Overview" in line:
has_overview = True

if "## Setup" in line:
has_setup = True

Expand All @@ -59,11 +60,11 @@ def readmes(ctx, integration):
f"https://raw.githubusercontent.com/DataDog/{repo}/master/{integration}/images/<IMAGE_NAME>"
)
continue

if not has_overview and integration not in NON_TILE_INTEGRATIONS:
errors = True
echo_failure(f"{integration} readme file does not have an overview section")

if not has_setup and integration not in NON_TILE_INTEGRATIONS:
errors = True
echo_failure(f"{integration} readme file does not have a setup section")
Expand Down