Skip to content

feat: add badge command for shields.io-compatible SVG safety score badge (Fixes #27)#35

Closed
lb1192176991-lab wants to merge 1 commit into
codegraphtheory:mainfrom
lb1192176991-lab:feat/svg-badge-27
Closed

feat: add badge command for shields.io-compatible SVG safety score badge (Fixes #27)#35
lb1192176991-lab wants to merge 1 commit into
codegraphtheory:mainfrom
lb1192176991-lab:feat/svg-badge-27

Conversation

@lb1192176991-lab

Copy link
Copy Markdown
Contributor

What

Adds a badge CLI command that generates a shields.io-compatible SVG badge showing a token's safety score and risk level. Embeddable in any README, website, or bio.

Why

An SVG badge is the standard trust signal for open-source projects. If tokens could embed a "\uD83D\uDEE1\uFE0F Safety: 79/100 \u2014 LOW" badge, it drives massive organic visibility for solana-rug.

Implementation

  • _svg_badge(report, style, label) generates shields.io-style SVG with f-strings
  • Color mapping: green (#4c1) for LOW, yellow (#e67e22) for MEDIUM, red (#e74c3c) for HIGH, dark red (#c0392b) for CRITICAL
  • --style flat|flat-square|plastic (shields.io compat)
  • --label TEXT custom left-side label (default: "safety")
  • Self-contained SVG — no external fonts, no network requests
  • Zero new dependencies — pure string templates

Examples

solana-rug badge DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263
solana-rug badge <MINT> --style flat-square --label rugcheck

Test coverage (6 tests)

  • Green/LOW badge contains correct color and score
  • Yellow/MEDIUM badge
  • Red/HIGH badge
  • Dark red/CRITICAL badge
  • Custom label rendering
  • Valid SVG structure verification

Fixes: #27

@codegraphtheory

Copy link
Copy Markdown
Owner

Superseded by the merged PR #45. Same feature, re-applied on latest main. Thanks for contributing!

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.

Rug safety score SVG badge (shields.io compatible)

2 participants