Skip to main content

sprezzature-ux-laws

License Python

🇫🇷 LISEZMOI.md · 🇬🇧 README.md

logo

A static Laws-of-UX auditor for HTML.

The "Laws of UX" are named heuristics from psychology and human-computer-interaction research: for instance, Hick's Law says that the more choices a screen offers at once, the longer a person takes to pick one, so a navigation menu with forty links is measurably harder to use than one with seven. This tool cannot see a rendered page or watch a real person use it; instead it reads the raw HTML text and flags the mistakes that are decidable from that text alone, such as counting the links in a <nav>. That trade keeps it fast and deterministic enough to run in a pre-commit hook or a CI step, at the cost of catching only the fraction of each law's violations that a text scan can see (the full, sourced definition of each law lives in references/laws-of-ux.md).

Laws covered

Law What it catches
Hick's Law Too many choices presented at once (over-long menus / nav).
Choice overload Long option lists with no grouping or default.
Miller's Law Unchunked digit runs (phone numbers, codes) beyond ~7 items.
Jakob's Law Non-conventional patterns where a familiar one is expected.
Fitts's Law Interactive controls with no 44 px (min-h-11) hit area.
Aesthetic-Usability Interactive elements missing a visible focus ring.
Selective attention Elements styled like ads that carry real content.
Tesler's Law Irreducible complexity pushed onto the user.

Use

# Audit a file or a whole directory tree
python scripts/audit_laws_of_ux.py public/index.html
python scripts/audit_laws_of_ux.py site/ --json

# Restrict to specific laws, or auto-fix the mechanical ones
python scripts/audit_laws_of_ux.py page.html --only fitts,jakob
python scripts/audit_laws_of_ux.py page.html --fix

Findings are error or warning; the process exits non-zero when an error is present, so it drops cleanly into CI.

Honest scope

The auditor catches mechanical, source-decidable violations. It does not judge whether a screen answers the right question or whether a flow makes sense. That stays a human call. It is a fast gate, not a substitute for design review.

License

BSD-3-Clause © Warith HARCHAOUI. Part of the sprezzature toolkit.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sprezzature_ux_laws-1.0.0.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sprezzature_ux_laws-1.0.0-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file sprezzature_ux_laws-1.0.0.tar.gz.

File metadata

  • Download URL: sprezzature_ux_laws-1.0.0.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.13

File hashes

Hashes for sprezzature_ux_laws-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a39df85de4349762e771a4acfd37fe1499420adafb598465792ad24bc6fa347e
MD5 9b6efaa92005f7afdcf9e39ee705003b
BLAKE2b-256 5ce22a11cfe819bf15fca17c40f142b850ef10732fb4704d0a30c1b2ad5deaaf

See more details on using hashes here.

File details

Details for the file sprezzature_ux_laws-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sprezzature_ux_laws-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14e51fc9100dfa6bf9c82e29131f9bff7da438682d0003e7b69f00e0715fb707
MD5 b8042884252a9f88306cea5d85a93a1b
BLAKE2b-256 2c36ace981a6eb5c39cf62b6b8b8c6dabb35bfe7da031df58389c96f6dd47668

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page