Skip to content

ci: fail on a BOM or text garbled by the wrong encoding - #156

Open
anurag629 wants to merge 1 commit into
devfrom
ci/encoding-check
Open

anurag629 wants to merge 1 commit into
devfrom
ci/encoding-check

Conversation

@anurag629

Copy link
Copy Markdown
Member

What does this change?

Adds a CI step right after checkout that fails when a file starts with a UTF-8 BOM or has text garbled by the wrong encoding, and prints every file and line it found. It looks for the BOM and for a few byte sequences that only show up when UTF-8 was read as another encoding, like a dash that turned into three other characters. The patterns are written as byte escapes, so the workflow file doesn't match itself.

Both have reached PRs this month: four new files with a BOM in the first version of toolbelt #190, and 24 garbled lines in its lib/tools.ts after a rebase. Review caught them, but CI should.

How I tested this

  • The step passes on the current base branch, so no file needs fixing first.
  • In a scratch repo with a BOM file and a garbled line, it fails and names both lines. A file with real dashes, arrows and middle dots passes.
  • Against the earlier commits of toolbelt #190 it flags the four BOM files on b7ef7fd, and the 24 garbled lines in lib/tools.ts plus the template's BOM on c7de664.
  • The workflow still parses as YAML.

This branch has not been deployed

No deployments
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.

1 participant