Skip to content

Make report formatters handle nil Changes #2

@devblac

Description

@devblac

Make report formatters handle nil Changes

Context

I hit a panic when calling the report formatters with a Result that didn’t populate Changes (early exit case). The CLI swallowed it, but a direct library call crashes.
 

Problem

FormatJSON, FormatHTML, and FormatText assume result.Changes is non-nil and dereference it unconditionally.
 

Expected behavior

Passing a Result with a nil Changes should return a valid string without panicking, treating missing changes as empty.
 

Scope / non-goals

  • Don’t alter the output shape when Changes is present; only guard the nil case.
  • No formatter redesigns.
     

Acceptance criteria

  • All three formatters return without panic when Changes is nil.
  • Existing formatter snapshots stay identical when Changes is set.
  • Tests cover the nil-Changes scenario for JSON, HTML, and text outputs.
     

Hints

  • internal/report/json.go, html.go, text.go and their tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is neededreporting

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions