-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
Codecov Report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome!! Could we also add validation that the Overview
and Setup
headers must be there since those are used for tiles tabs?
…into sarah/readme-validation
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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") | |
if integration not in NON_TILE_INTEGRATIONS and not has_overview or not has_setup: | |
errors = True | |
echo_failure(f"{integration} readme file needs to have an overview and setup section.") |
Since these two are same issue (README section headers), I think we could simplify the error. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I could do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 🥇
datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/readmes.py
Show resolved
Hide resolved
datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/readmes.py
Show resolved
Hide resolved
datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/readmes.py
Show resolved
Hide resolved
datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/readmes.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/readmes.py
Outdated
Show resolved
Hide resolved
…e/readmes.py Co-authored-by: Nicholas Muesch <nicholas.muesch@datadoghq.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thanks!
f"https://raw.githubusercontent.com/DataDog/{repo}/master/{integration}/images/<IMAGE_NAME>" | ||
) | ||
|
||
rel_path = match.groups()[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think need to abort above or put this in an else, otherwise we never see the failure message above if match doesn't exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: sorry you do see the error message above, but it gets drowned out a bit by a stacktrace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I updated to break if there's a failure!
…integrations-core into sarah/readme-validation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for this! I left one note about the formatting of the output but I don't think it needs to block.
match = re.match(IMAGE_REGEX, line) | ||
if not match: | ||
errors = True | ||
echo_failure(f"{integration} readme file does not have a valid image file on line {line_no}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I noticed is that the other validations print the integration name once when there is an error, then print each error message on a newline with a slight indent, to group errors per integration
Example in the manifest validations - https://github.com/DataDog/integrations-core/blob/master/datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/manifest.py#L289-L301
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that format! I updated the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thanks!
* Add utility functions * Add readme validation * Move function * Add to CI * Go back to original comment * Simplify logic * Check for overview and setup * Fix style * Simplify error * Test for exact wording * Fix style * Check that path exists * Update extensions * Remove test for non tile ints * Update datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/readmes.py Co-authored-by: Nicholas Muesch <nicholas.muesch@datadoghq.com> * Break if readme is invalid * Fix style * Fix style * Update to have display queue * Add noqa Co-authored-by: Nicholas Muesch <nicholas.muesch@datadoghq.com> e220790
What does this PR do?
Adds validation for images in READMEs.
Motivation
Additional Notes
TODO: update developer docs
depends on:
Review checklist (to be filled by reviewers)
changelog/
andintegration/
labels attached