mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-06 12:06:53 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
7abaf07fb5
commit
5008ecfb20
1 changed files with 4 additions and 3 deletions
|
|
@ -8,6 +8,7 @@ from typing import Sequence
|
||||||
from pre_commit_hooks.util import CalledProcessError
|
from pre_commit_hooks.util import CalledProcessError
|
||||||
from pre_commit_hooks.util import cmd_output
|
from pre_commit_hooks.util import cmd_output
|
||||||
|
|
||||||
|
|
||||||
def has_naming_convention(
|
def has_naming_convention(
|
||||||
patterns: AbstractSet[str] = frozenset(),
|
patterns: AbstractSet[str] = frozenset(),
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
|
@ -17,7 +18,7 @@ def has_naming_convention(
|
||||||
return False
|
return False
|
||||||
chunks = ref_name.strip().split('/')
|
chunks = ref_name.strip().split('/')
|
||||||
branch_name = '/'.join(chunks[2:])
|
branch_name = '/'.join(chunks[2:])
|
||||||
|
|
||||||
return any(
|
return any(
|
||||||
re.match(p, branch_name) for p in patterns
|
re.match(p, branch_name) for p in patterns
|
||||||
)
|
)
|
||||||
|
|
@ -39,9 +40,9 @@ def main(argv: Sequence[str] | None = None) -> int:
|
||||||
args = parser.parse_args(argv)
|
args = parser.parse_args(argv)
|
||||||
|
|
||||||
patterns = frozenset(args.pattern or ())
|
patterns = frozenset(args.pattern or ())
|
||||||
|
|
||||||
return int(has_naming_convention(patterns))
|
return int(has_naming_convention(patterns))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
raise SystemExit(main())
|
raise SystemExit(main())
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue