Skip to content

CLOS-4334: Remove BOM file markers and introduce non-ASCII check action#53

Merged
azheregelya merged 5 commits intocloudlinux:cloudlinuxfrom
prilr:remove-bom
Apr 27, 2026
Merged

CLOS-4334: Remove BOM file markers and introduce non-ASCII check action#53
azheregelya merged 5 commits intocloudlinux:cloudlinuxfrom
prilr:remove-bom

Conversation

@prilr
Copy link
Copy Markdown
Collaborator

@prilr prilr commented Apr 27, 2026

Likely caused by editor settings that were not noticed at the time.

Also adds the corresponding check to the lint command in Makefile.

prilr added 5 commits April 27, 2026 00:59
Likely caused by editor settings that were not noticed at the time.
After the fix in b24a939, introducing additional check to ensure the same problem doesn't happen again.
…putils.py

The earlier BOM cleanup (commit 81fb25d "Remove BOM file markers from
files that had them introduced previously") missed this one file. The
new lint-cloudlinux GitHub Action surfaced it on a dry run.
The non-ASCII gate added in commit 92aee84 lived inline in the lint
target and used a plain grep that did not honor PEP 263 encoding
declarations. Two tradeoffs followed:

  - CI cannot easily reuse just that step without running the full lint
    pipeline (pylint + flake8), and the full pipeline is currently noisy
    on the cloudlinux tree.
  - Test fixtures that legitimately contain non-ASCII (e.g.
    rootscanner/tests/test_rootscanner.py with Cyrillic strings declared
    via '# -*- coding: utf-8 -*-') trip the grep even though Python
    accepts them.

Move the check to utils/check-non-ascii.py, a small stdlib-only python3
script that walks the supplied paths, skips files with a PEP 263
declaration on line 1 or 2, and reports lineno + line text for every
remaining offender.

Wire the script into the Makefile as a new lint-non-ascii target and
make it a prerequisite of lint, so the existing developer-facing
behavior is unchanged: `make lint` still does the non-ASCII check
plus pylint plus flake8, just via a script instead of an inline grep.
A standalone target also lets CI invoke just this gate without paying
for the full lint venv setup.
The cloudlinux fork uses the cloudlinux branch as trunk; the inherited
upstream workflows (unit-tests.yml, codespell.yml, etc.) only fire on
master so they never run for PRs into this fork. Add a narrow workflow
that runs on every push and PR targeting cloudlinux and invokes
`make lint-non-ascii` to gate against stray non-ASCII bytes in Python
source.

Calling the make target keeps a single source of truth: local
`make lint` runs the same check via the same script, so what passes
locally is exactly what passes in CI.

Resurrecting the full upstream test+lint matrix on this fork is a
separate, larger task.
@prilr prilr changed the title Remove BOM file markers from files that had them introduced previously CLOS-4334: Remove BOM file markers and introduce non-ASCII check action Apr 27, 2026
@prilr
Copy link
Copy Markdown
Collaborator Author

prilr commented Apr 27, 2026

Originally this was just about BOM markers rediscovered by accident, but that alone did not answer the question "how do we prevent this from happening again?".
The branch grew as a result.

@azheregelya azheregelya merged commit e7ffe6e into cloudlinux:cloudlinux Apr 27, 2026
1 check passed
@prilr prilr deleted the remove-bom branch April 27, 2026 16:04
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.

2 participants