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

feat: ✨ add functions to check required and blank fields [3/7] #963

Open
wants to merge 7 commits into
base: feat/sprout-checks-2-simple-helper-functions
Choose a base branch
from

Conversation

martonvago
Copy link
Contributor

@martonvago martonvago commented Jan 10, 2025

Description

This PR adds functions for checking that (Sprout-specific) required fields are present and not blank.

This PR needs an in-depth review.

Checklist

  • Added or updated tests
  • Updated documentation
  • Ran just run-all

@martonvago martonvago self-assigned this Jan 10, 2025
Comment on lines +28 to +31
errors += check_list_item_field_not_blank(properties, "contributors", "title")
errors += check_list_item_field_not_blank(properties, "sources", "title")
errors += check_list_item_field_not_blank(properties, "licenses", "name")
errors += check_list_item_field_not_blank(properties, "licenses", "path")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are nested package properties fields (so, technically, fields on contributor properties, source properties, etc.). It would be nice if they were also coming from a constant like the top-level fields from PACKAGE_SPROUT_REQUIRED_FIELDS. Something to keep in mind / return to when we look at these nested properties more closely?

@martonvago martonvago changed the title feat: ✨ add functions to check required and blank fields feat: ✨ add functions to check required and blank fields [3/7] Jan 10, 2025
@martonvago martonvago marked this pull request as ready for review January 10, 2025 23:20
@martonvago martonvago requested a review from a team as a code owner January 10, 2025 23:20
Copy link
Member

@lwjohnst86 lwjohnst86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Only same comments/suggestions from the PR this is stacked on.

Copy link
Member

@signekb signekb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oo, just saw that I never finished my review from last week. Added it now 👍

A list of errors. An empty list if no errors were found.
"""
errors = check_fields_not_blank(properties, PACKAGE_SPROUT_REQUIRED_FIELDS)
errors += check_list_item_field_not_blank(properties, "contributors", "title")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't contributor title just recommended and not required as described here?
Same with sources title?
They are required to have one property, but which property it is isn't specified.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but we have checks for recommendations turned on in Sprout. At least, I turned them on :P

tests/core/sprout_checks/test_check_fields_not_blank.py Outdated Show resolved Hide resolved
@martonvago martonvago requested a review from lwjohnst86 January 20, 2025 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

3 participants