CI linter should ignore BOM

Summary

The CI/CD Pipeline linter does not handle the UTF-8 Byte-Order Mark (BOM) correctly. If a stage: definition is on the first line of a file with a BOM the linter will report This GitLab CI configuration is invalid: jobs config should contain at least one visible job.

Steps to reproduce

  1. Create a UTF-8 text file with BOM; define stage: on the first line
  2. Upload to a project as .gitlab-ci.yml
  3. Check that linter reports jobs config should contain at least one visible job

Example Project

https://gitlab.com/gitlab-gold/all-base

What is the current bug behavior?

CI file is incorrectly rejected because no jobs are visible

What is the expected correct behavior?

The file should work as normal, since the BOM is invisible to our editors / file viewers.

Relevant logs and/or screenshots

bom

Output of checks

Results of GitLab environment info

Happens on Gitlab.com: GitLab Enterprise Edition 14.9.0-pre 329cae13

Possible fixes