-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78ca05f
commit 92b2f68
Showing
5 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
- id: sync-uv-pre-commit | ||
name: Sync uv and pre commit | ||
description: Sync uv and pre commit | ||
language: script | ||
entry: "uv run script.py" | ||
language: python | ||
entry: sync_uv_pre_commit | ||
minimum_pre_commit_version: "3.5.0" | ||
require_serial: true | ||
always_run: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from __future__ import annotations | ||
|
||
import subprocess | ||
import sys | ||
from pathlib import Path | ||
|
||
from sync_uv_pre_commit.log import ExitCode, logger | ||
|
||
|
||
def main() -> None: # noqa: D103 | ||
process = subprocess.run( # noqa: S603 | ||
["uv", "run", str(Path(__file__).parent / "output.py")], # noqa: S607 | ||
check=False, | ||
capture_output=True, | ||
text=True, | ||
) | ||
try: | ||
process.check_returncode() | ||
except subprocess.CalledProcessError as exc: | ||
logger.error("error: %s", exc.stderr) | ||
if exc.returncode == ExitCode.MISSING.value: | ||
sys.exit(ExitCode.MISSING) | ||
if exc.returncode == ExitCode.PARSING.value: | ||
sys.exit(ExitCode.PARSING) | ||
sys.exit(ExitCode.UNKNOWN) | ||
else: | ||
logger.info("success: %s", process.stdout) |