Skip to content

Validate website field#1219

Open
AdwaithaV wants to merge 7 commits into
Qiskit:mainfrom
AdwaithaV:validate-website-field
Open

Validate website field#1219
AdwaithaV wants to merge 7 commits into
Qiskit:mainfrom
AdwaithaV:validate-website-field

Conversation

@AdwaithaV

@AdwaithaV AdwaithaV commented Jul 3, 2026

Copy link
Copy Markdown

This PR adds a validation check to prevent redundant website URLs in submissions. The new validation rejects cases where member.website duplicates an existing GitHub repository URL or a PyPI project URL.

@1ucian0 @garrison @blakejohnson I also attempted to run the full local pytest suite, but test collection currently fails due to an unrelated existing syntax error in tests/test_check.py on the main branch. My changes are limited to ecosystem/validation/test_url.py.

Please let me know if this validation approach looks acceptable. If needed, I can also open a separate issue and work on fixing the pytest syntax error in tests/test_check.py as a follow-up contribution.

Fixes #1087

@CLAassistant

CLAassistant commented Jul 3, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@AdwaithaV

AdwaithaV commented Jul 3, 2026

Copy link
Copy Markdown
Author

@1ucian0 @garrison @blakejohnson I tested the changes locally using pytest, pylint, and black formatting checks. The validation tests passed successfully, pylint reported a 10.00/10 score, and the file was reformatted using black to match repository style requirements.
image
image
image

@AdwaithaV

Copy link
Copy Markdown
Author

This is the latest update and final version of the PR. I improved the validation logic by normalizing hostnames before comparison, added handling for repository subpaths so URLs like /tree/main and other nested GitHub paths are correctly detected, and added support for additional PyPI hostname variants such as pypi.python.org. I also expanded the documentation URL validation checks to cover more GitHub documentation edge cases. The updated file was formatted using black, verified with pylint, and successfully checked with python -m py_compile. The targeted validation tests are passing successfully. Running the complete pytest suite is still blocked by an existing upstream syntax error in tests/test_check.py, along with unrelated missing optional dependencies in some documentation/ directories. @garrison @1ucian0 @blakejohnson Please review the changes whenever convenient, and let me know if any further improvements are needed.

@1ucian0

1ucian0 commented Jul 7, 2026

Copy link
Copy Markdown
Member

No need to ping at people, the PR will get reviewed eventually :)

@1ucian0 1ucian0 moved this to PR open / Contributor working on it in Contributor Monitoring Jul 7, 2026
@1ucian0 1ucian0 moved this from PR open / Contributor working on it to Waiting for maintainer response in Contributor Monitoring Jul 7, 2026
@1ucian0 1ucian0 self-assigned this Jul 7, 2026
@AdwaithaV

Copy link
Copy Markdown
Author

Thank you for letting me know. Sorry I didn't know about this. I am still learning how open source works. I won't ping reviewers in future PRs. Thanks for the guidance..

@1ucian0 1ucian0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! few comments here and there.

Comment thread ecosystem/validation/test_url.py
Comment thread ecosystem/validation/test_url.py Outdated
continue

@staticmethod
def normalize_url(url):

@1ucian0 1ucian0 Jul 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe you can bake these normalizatoins inside get_all_urls

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thaks for the suggestion .Since get_all_urls() is also used by test_http(), would you prefer inlining the normalization into is_same_or_subpath(), or did you have a different approach in mind for get_all_urls()

Comment thread ecosystem/validation/test_url.py Outdated
if package_url is None:
continue

hostname = (package_url.hostname or "").lower()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think URL already lowers the case of hostname

Comment thread ecosystem/validation/test_url.py Outdated
# Reject PyPI URLs as website
pypi_packages = getattr(member, "pypi", {})

for _, package in pypi_packages.items():

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

no need to fetch the python package. If the website is a pypi link, that's enough.

@github-project-automation github-project-automation Bot moved this from Waiting for maintainer response to Waiting for contributor in Contributor Monitoring Jul 9, 2026
AdwaithaV and others added 2 commits July 10, 2026 12:56
Co-authored-by: Luciano Bello <766693+1ucian0@users.noreply.github.com>
Comment on lines +52 to +53
@staticmethod
def is_same_or_subpath(candidate, reference):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe it can be implemented as an assertion:

Suggested change
@staticmethod
def is_same_or_subpath(candidate, reference):
def assertSameSubpath(self, candidate, reference):

Comment thread resources/checks.toml Outdated
Co-authored-by: Luciano Bello <766693+1ucian0@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting for contributor

Development

Successfully merging this pull request may close these issues.

add new checkup: validate that website is not just a link to github repo or to pypi package site

3 participants