Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve precommit failing #192

Merged
merged 4 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
hooks:
# use black formatting
- id: ruff-format
name: Black by Ruff
# basic check
- id: ruff
name: Ruff check
args: ["--fix"]
# use black formatting
- id: ruff-format
name: Black by Ruff
16 changes: 4 additions & 12 deletions cachier/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
# Copyright (c) 2024, Jirka Borovec <***@gmail.com>

import os
import subprocess
from subprocess import DEVNULL

_PATH_HERE = os.path.dirname(__file__)
_PATH_ROOT = os.path.dirname(_PATH_HERE)
_PATH_VERSION = os.path.join(_PATH_HERE, "version.info")
_RELEASING_PROCESS = os.getenv("RELEASING_PROCESS", "0") == "1"

Expand All @@ -19,15 +16,10 @@


def _get_git_sha() -> str:
if not os.path.isdir(os.path.join(_PATH_ROOT, ".git")):
return ""
out = subprocess.check_output( # noqa: S603, S607
["git", "rev-parse", "HEAD"],
stderr=DEVNULL,
)
sha = out.decode("utf-8").strip()
# SHA short
return sha[:7]
from subprocess import check_output, DEVNULL

out = check_output(["git", "rev-parse", "--short", "HEAD"], stderr=DEVNULL) # noqa: S603, S607
return out.decode("utf-8").strip()


if not _RELEASING_PROCESS:
Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ blank = true
target-version = "py38"
line-length = 79
# Enable Pyflakes `E` and `F` codes by default.
select = [
lint.select = [
"E",
"W", # see: https://pypi.org/project/pycodestyle
"F", # see: https://pypi.org/project/pyflakes
Expand All @@ -46,7 +46,7 @@ select = [
"S", # see: https://pypi.org/project/flake8-bandit
"SIM",
]
ignore = [
lint.ignore = [
"E203",
"C901",
]
Expand All @@ -60,10 +60,10 @@ exclude = [
"build",
"dist",
]
ignore-init-module-imports = true
unfixable = ["F401"]
lint.ignore-init-module-imports = true
lint.unfixable = ["F401"]

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

#[tool.ruff.pydocstyle]
Expand All @@ -73,6 +73,6 @@ unfixable = ["F401"]
#[tool.ruff.pycodestyle]
#ignore-overlong-task-comments = true

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