Lucas-C/pre-commit-hooks

Tabs are replaced in this binary string

StephenCarboni opened this issue · 3 comments

$ python -V
Python 3.10.2
# .pre-commit-config.yaml
repos:
-   repo: git://github.com/Lucas-C/pre-commit-hooks.git
    rev: v1.1.13
    hooks:
    -   id: remove-tabs
# example.py
TEST_DATA = b"AZ	SHN	999	SH	Saint Helena	410	7460	AF	.sh	AUD	Pound	290	STHL 1ZZ"

After running this, the tabs are replace with spaces.

$ pre-commit run remove-tabs --files example.py

Alright, I agree :)

What is the issue exactly, and what do you suggest to solve it?

Have you tried using exclude?
https://pre-commit.com/#top_level-exclude

Well, if I were to say that you should leave literal values alone, would you say that that means there should be a https://github.com/Lucas-C/pre-commit-hooks-python with this hook?

Maybe I'm misunderstanding here and removing ALL tabs is the goal of the hook, regardless of breaking code.

Yes, the goal of the remove-tabs hook is to replace all tabs by some spaces.
It is not designed to parse / undertand source code in any language.
Feel free to create your own hook if you have a need for a more intelligent hook 😊