Skip to content

sanchitram1/permalint

Repository files navigation

permalint

Release Coverage Status

Lint URLs (mostly for teaxyz/chai, but hopefully other uses too)

Features

  • Ignores protocol (http, https, etc.)
  • Normalizes GitHub URLs to owner/repo
  • Removes query strings and fragments
  • Lowercases domains and removes www

Usage

from permalint import normalize_url

url = "https://github.com/user/repo?utm_source=foo#readme"
print(normalize_url(url))  # Output: github.com/user/repo

Development

  • Install dependencies: uv sync
  • Run tests: uv run pytest
  • Lint: uv run ruff check . && uv run ruff format .
  • Type check: uv run ty check src/

Contributing / Wishlist

  • guess-canonical-url to guess the correct URL based on a passed list of URLs

Tasks

cov

Requires the COVERALLS_REPO_TOKEN to be set in a .env file

export $(grep -v '^#' .env | xargs)
uv run coveralls

lint

uv run ruff check . --fix --unsafe-fixes
uv run format .

About

lint URLs

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages