Skip to content

Syntax highlighting false positive drifts #1062

@thiagowfx

Description

@thiagowfx

Describe the bug

Syntax highlighting incorrectly marks lines as deletions

Steps to reproduce

Given some terraform outputs that emit bullet point list items or CLI switches in their own lines (see snippets below), run terraform plan (e.g. on a PR), then observe the incorrect formatting. Terrateam treats leading dashes (-) as if terraform resources were being removed, highlighting them with red.

Expected behavior

No diffs on bullet point list items, no diffs on CLI switches.

Actual behavior

Observed diffs on bullet point list items, as part of terraform outputs:

 Allowed DNS values (targets for your records):
  - dns-garden-3.{redacted}.
  - dns-garden-8.{redacted}.
  - dns-garden-11.{redacted}.
[...]
Image

Diffs on CLI switches, as part of terraform outputs:

[...]
  2. To delete a DNS record:
     curl -X DELETE https://{redacted}.execute-api.us-east-1.amazonaws.com/v1 \
       -H "x-api-key: [YOUR_API_KEY]" \
       -H "Content-Type: application/json" \
       -d '{"dns_record": "example.{redacted}"}'
[...]

Terrateam incorrectly formats / colorizes it like this on github (screenshot 1), and also in the web app (screenshot 2) – this only happens with syntax highlighting enabled:

Image Image

Terrateam version & environment details

The latest version as of the time of this issue

Additional context

Originally reported via Slack: https://terrateamio.slack.com/archives/C02GDJFTZ2Q/p1766285388781529?thread_ts=1764947614.375509&cid=C02GDJFTZ2Q

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions