-
-
Notifications
You must be signed in to change notification settings - Fork 761
Attempt to add fixing of BOMs #522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should deprecate check-byte-order-marker, but we cannot remove it in this PR
3de1539
to
5a7ca4e
Compare
Sorry for the churn, I don't write much Python |
c8ef07f
to
f3cee4e
Compare
Okay, I think this is good now. |
Would you mind adding a hacktoberfest-accepted label to this PR? I didn't make this change specifically for hacktoberfest, I need it, but I am participating in hacktoberfest. Thanks! |
yeah sorry I've been slow about this -- I'll take a look when I get the chance 👍 |
f3cee4e
to
d18bd5b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- id: check-byte-order-marker | ||
name: Check for byte-order marker | ||
description: Forbid files which have a UTF-8 byte-order marker | ||
name: 'check BOM - deprecated: use fix-byte-order-marker' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I shortened the name here so it doesn't wrap -- I should probably add a test for this
entry: file-contents-sorter | ||
language: python | ||
files: '^$' | ||
- id: fix-byte-order-marker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed this to fix-byte-order-marker
so it's more clear what it does
|
||
def main(argv: Optional[Sequence[str]] = None) -> int: | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('filenames', nargs='*', help='Filenames to check') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the --fix=no
-- I'd rather have formatters-only
|
||
for filename in args.filenames: | ||
with open(filename, 'rb') as f_b: | ||
bts = f_b.read(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there was a leaking file descriptor here, I fixed that
… (hetznercloud/fleeting-plugin-hetzner!264) This MR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [pre-commit/pre-commit-hooks](https://github.com/pre-commit/pre-commit-hooks) | repository | major | `v5.0.0` -> `v6.0.0` | Note: The `pre-commit` manager in Renovate is not supported by the `pre-commit` maintainers or community. Please do not report any problems there, instead [create a Discussion in the Renovate repository](https://github.com/renovatebot/renovate/discussions/new) if you have any questions. --- ### Release Notes <details> <summary>pre-commit/pre-commit-hooks (pre-commit/pre-commit-hooks)</summary> ### [`v6.0.0`](https://github.com/pre-commit/pre-commit-hooks/releases/tag/v6.0.0): pre-commit-hooks v6.0.0 [Compare Source](pre-commit/pre-commit-hooks@v5.0.0...v6.0.0) #### Fixes - `check-shebang-scripts-are-executable`: improve error message. - [#​1115](pre-commit/pre-commit-hooks#1115) MR by [@​homebysix](https://github.com/homebysix). #### Migrating - now requires python >= 3.9. - [#​1098](pre-commit/pre-commit-hooks#1098) MR by [@​asottile](https://github.com/asottile). - `file-contents-sorter`: disallow `--unique` and `--ignore-case` at the same time. - [#​1095](pre-commit/pre-commit-hooks#1095) MR by [@​nemacysts](https://github.com/nemacysts). - [#​794](pre-commit/pre-commit-hooks#794) issue by [@​teksturi](https://github.com/teksturi). - Removed `check-byte-order-marker` and `fix-encoding-pragma`. - `check-byte-order-marker`: migrate to `fix-byte-order-marker`. - `fix-encoding-pragma`: migrate to `pyupgrade`. - [#​1034](pre-commit/pre-commit-hooks#1034) MR by [@​mxr](https://github.com/mxr). - [#​1032](pre-commit/pre-commit-hooks#1032) issue by [@​mxr](https://github.com/mxr). - [#​522](pre-commit/pre-commit-hooks#522) MR by [@​jgowdy](https://github.com/jgowdy). </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS42MS4xIiwidXBkYXRlZEluVmVyIjoiNDEuNjEuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
I'm attempting to add automatic fixing of BOMs