Skip to content

Implement report.md formatting #148

@matejchalk

Description

@matejchalk

As user whose trying out Code PushUp for the first time, I want an easy to read (i.e. not raw JSON) report after I've succesfully ran the CLI for the first time (based on getting started docs).

Based on discussion in #93

General notes

  • scores (0-1) formatted as Math.round(score * 100) (0-100, only integers)
  • links to headings have to slugify the heading text
  • everything that's in <details> (including <summary>) must use HTML formatting, Markdown won't be rendered
  • score colours:
    • category and groups scores are annotated with 🟢, 🟡, or 🔴
    • audit value and score are annotated with 🟩, 🟨, or 🟥
    • determined by score value:
      • score < 0.5 => red
      • 0.5 <= score < 0.9 => yellow
      • score >= 0.9 => green

Structure

  • heading 1: "Code PushUp report"
  • intro section
    • Markdown table with category scores
    • Category cells contain title with link to category detail
    • Audits cells should number of referenced audits (from category refs, ref to group expanded to number of audits)
  • heading 2: "Categories"
  • categories section - lists all categories
    • category detail:
      • heading 3: category title
      • score
      • unordered list based on category refs (regardless of weight)
        • referenced audits:
          • colour based on audit's score
          • audit title with link to audit detail
          • plugin title in brackets
          • display value in bold - if missing, show raw value instead
        • referenced groups:
          • colour based on group's score
          • group title with plugin title in brackets
          • sub-list with all audits referenced by group
            • audit's formatting is the same as for those referenced by category directly (see above) - only difference is plugin title is omitted
  • heading 2: "Audits"
  • audits section - lists all audits from all plugins
    • audit detail:
      • heading 3: audit title with plugin in brackets
      • result summary: colour from score, display/raw value in bold, score in brackets
      • if audit has details with issues, result used as summary for expandable details section:
        • heading 4: "Issues"
        • table which list all issues (we only have source code issues at present)
          • severity - icons: error => 🚨, warning => ⚠️, info => ℹ️ (or nothing?)
          • message (nice-to-have: transform MD to HTML)
          • source file path - file links part of Git URLs in Markdown reports and diffs #149
          • source file line(s) - 7 if only start line, 7-10 if both (different) start and end lines, - if no lines
      • audit description (if present)
      • link to audit docs (if present)
  • heading 2: "About"
  • Report was created by Code PushUp on DATE.
    • as URL, use CLI package README link for now (later: our website)
    • date formatted as new Date().toString()
  • table with metadata about the run:
    • commit message and truncated hash (current commit in Git) - commit links part of Git URLs in Markdown reports and diffs #149
    • package version
    • duration (formatted in seconds)
    • number of plugins
    • number of audits (in total)
    • number of categories
  • The following plugins were run:
  • table with metadata for each plugin:
    • plugin title, with link to plugin docs (if present)
    • number of audits (from this plugin)
    • plugin's package version (if present, otherwise n/a)
    • plugin's duration

Example

Follows below line...


Code PushUp report

🏷️ Category ⭐ Score 🛡️ Audits
Performance 🟢 92 5
Code style 🟡 54 12

🏷️ Categories

Performance

🟢 Score: 92

Code style

🟡 Score: 54

🛡️ Audits

Largest Contentful Paint (Lighthouse)

🟨 1.5 s (score: 75)

📖 Docs

Disallow missing key props in iterators/collection literals (ESLint)

🟥 1 error (score: 0)

Issues

Severity Message Source file Line(s)
🚨 error Missing "key" prop for element in iterator src/components/TodoList.jsx 7

ESLint rule jsx-key, from react plugin. 📖 Docs

Require or disallow method and property shorthand syntax for object literals (ESLint)

🟥 4 warnings (score: 0)

Issues

Severity Message Source file Line(s)
⚠️ warning Expected property shorthand src/hooks/useTodos.js 19
⚠️ warning Expected property shorthand src/hooks/useTodos.js 32
⚠️ warning Expected property shorthand src/hooks/useTodos.js 33

ESLint rule object-shorthand. 📖 Docs

Require let or const instead of var (ESLint)

🟩 0 (score: 100)

ESLint rule no-var. 📖 Docs

About

Report was created by Code PushUp on Tue Oct 24 2023 09:38:51 GMT+0200 (Central European Summer Time).

Commit Version Duration Plugins Categories Audits
Implement todos list (3ac01d1) 0.1.0 1.6 s 2 3 25

The following plugins were run:

Plugin Audits Version Duration
ESLint 20 0.1.0 0.3 s
Lighthouse 5 0.1.0 1.2 s

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions