Skip to content

Commit 47440f2

Browse files
authored
resolve precommit failing (#192)
* removing the anoying fail msg * DEVNULL * alternative
1 parent c3d756b commit 47440f2

3 files changed

Lines changed: 13 additions & 21 deletions

File tree

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ repos:
6666
- repo: https://github.com/astral-sh/ruff-pre-commit
6767
rev: v0.2.1
6868
hooks:
69-
# use black formatting
70-
- id: ruff-format
71-
name: Black by Ruff
7269
# basic check
7370
- id: ruff
7471
name: Ruff check
7572
args: ["--fix"]
73+
# use black formatting
74+
- id: ruff-format
75+
name: Black by Ruff

cachier/_version.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
# Copyright (c) 2024, Jirka Borovec <***@gmail.com>
77

88
import os
9-
import subprocess
10-
from subprocess import DEVNULL
119

1210
_PATH_HERE = os.path.dirname(__file__)
13-
_PATH_ROOT = os.path.dirname(_PATH_HERE)
1411
_PATH_VERSION = os.path.join(_PATH_HERE, "version.info")
1512
_RELEASING_PROCESS = os.getenv("RELEASING_PROCESS", "0") == "1"
1613

@@ -19,15 +16,10 @@
1916

2017

2118
def _get_git_sha() -> str:
22-
if not os.path.isdir(os.path.join(_PATH_ROOT, ".git")):
23-
return ""
24-
out = subprocess.check_output( # noqa: S603, S607
25-
["git", "rev-parse", "HEAD"],
26-
stderr=DEVNULL,
27-
)
28-
sha = out.decode("utf-8").strip()
29-
# SHA short
30-
return sha[:7]
19+
from subprocess import check_output, DEVNULL
20+
21+
out = check_output(["git", "rev-parse", "--short", "HEAD"], stderr=DEVNULL) # noqa: S603, S607
22+
return out.decode("utf-8").strip()
3123

3224

3325
if not _RELEASING_PROCESS:

pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ blank = true
3636
target-version = "py38"
3737
line-length = 79
3838
# Enable Pyflakes `E` and `F` codes by default.
39-
select = [
39+
lint.select = [
4040
"E",
4141
"W", # see: https://pypi.org/project/pycodestyle
4242
"F", # see: https://pypi.org/project/pyflakes
@@ -46,7 +46,7 @@ select = [
4646
"S", # see: https://pypi.org/project/flake8-bandit
4747
"SIM",
4848
]
49-
ignore = [
49+
lint.ignore = [
5050
"E203",
5151
"C901",
5252
]
@@ -60,10 +60,10 @@ exclude = [
6060
"build",
6161
"dist",
6262
]
63-
ignore-init-module-imports = true
64-
unfixable = ["F401"]
63+
lint.ignore-init-module-imports = true
64+
lint.unfixable = ["F401"]
6565

66-
[tool.ruff.per-file-ignores]
66+
[tool.ruff.lint.per-file-ignores]
6767
"tests/**" = ["S101", "S311", "S105", "S603"]
6868

6969
#[tool.ruff.pydocstyle]
@@ -73,6 +73,6 @@ unfixable = ["F401"]
7373
#[tool.ruff.pycodestyle]
7474
#ignore-overlong-task-comments = true
7575

76-
[tool.ruff.mccabe]
76+
[tool.ruff.lint.mccabe]
7777
# Unlike Flake8, default to a complexity level of 10.
7878
max-complexity = 10

0 commit comments

Comments
 (0)