Skip to content

Commit da21b9b

Browse files
authored
Add deprecation messaging for fix-encoding-pragma
1 parent c8715b7 commit da21b9b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.pre-commit-hooks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
language: python
146146
types: [text]
147147
- id: fix-encoding-pragma
148-
name: fix python encoding pragma
148+
name: fix python encoding pragma (deprecated)
149149
description: 'adds # -*- coding: utf-8 -*- to the top of python files.'
150150
language: python
151151
entry: fix-encoding-pragma

pre_commit_hooks/fix_encoding_pragma.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import argparse
4+
import sys
45
from typing import IO
56
from typing import NamedTuple
67
from typing import Sequence
@@ -107,6 +108,12 @@ def _normalize_pragma(pragma: str) -> bytes:
107108

108109

109110
def main(argv: Sequence[str] | None = None) -> int:
111+
print(
112+
"warning: this hook is deprecated and will be removed in a future "
113+
"release because py2 is EOL",
114+
file=sys.stderr
115+
)
116+
110117
parser = argparse.ArgumentParser(
111118
'Fixes the encoding pragma of python files',
112119
)

0 commit comments

Comments
 (0)