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

docs: fix link to homepage #351

Merged
merged 1 commit into from
Dec 21, 2023
Merged

docs: fix link to homepage #351

merged 1 commit into from
Dec 21, 2023

Conversation

henryiii
Copy link
Collaborator

I think this was a replacement mistake when moving over. This the the homepage for sp-repo-review, so linking to the GitHub page seems to make sense.

Fix #331.

Not sure what the best way to check for this might be, might be something a link check tool could support?

I think this was a replacement mistake when moving over. This the the homepage for sp-repo-review, so linking to the GitHub page seems to make sense.
@henryiii henryiii merged commit 275c43d into main Dec 21, 2023
@henryiii henryiii deleted the henryiii-patch-1 branch December 21, 2023 21:51
@afuetterer
Copy link

Hi @henryiii.

If there is no linkchecker for this sort of check, maybe a custom script could help?

Something like this? Not sure when or where to run this. It could be a pre-commit-hook, but if it talks to the network on every commit, this might be slowing things down. Mabye run this in CI?

import logging
import requests
import toml

logger = logging.getLogger(__name__)

with open("pyproject.toml") as f:
    data = toml.load(f)

urls = data.get("project", {}).get("urls", {})

with requests.Session() as session:
    for label, url in urls.items():
        try:
            response = session.get(url)
            response.raise_for_status()
            logger.debug(f"URL for '{label}' is valid: {url}")
        except requests.exceptions.HTTPError:
            logger.warning(f"URL for '{label}' returned a non-success status code: {url}")
        except requests.exceptions.RequestException as e:
            logger.error(f"Error checking URL for '{label}': {url}\nError: {e}")

Or this is stupid?

@henryiii
Copy link
Collaborator Author

I think you could use Linkchecker, though it doesn't have an appropriate plugin AFAIK (https://linkchecker.github.io/linkchecker/man/linkchecker.html#plugins), you can just run it on the URLs, I think.

(PS: use tomllib or tomli, toml has been dead for years)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Homepage in [project.urls] not found
2 participants