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

Update linters #178

Merged
merged 1 commit into from
Jan 11, 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
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ ci:
skip: [markdownlint_docker]
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.264"
rev: "v0.1.11"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/pre-commit/mirrors-prettier
# keep it before yamllint
rev: v3.0.0-alpha.9-for-vscode
rev: v4.0.0-alpha.8
hooks:
- id: prettier
always_run: true
Expand All @@ -22,12 +22,12 @@ repos:
hooks:
- id: markdownlint_docker
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.12.1
hooks:
- id: black
args: [--safe]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand All @@ -38,14 +38,14 @@ repos:
- id: debug-statements
language_version: python3
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.31.0
rev: v1.33.0
hooks:
- id: yamllint
files: \.(yaml|yml)$
types: [file, yaml]
entry: yamllint --strict
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.2.0
rev: v1.8.0
hooks:
- id: mypy
# mypy args needed in order to match mypy cli behavior
Expand All @@ -61,7 +61,7 @@ repos:
- subprocess-tee
- typer>=0.7.0
- repo: https://github.com/pycqa/pylint
rev: v3.0.0a6
rev: v3.0.3
hooks:
- id: pylint
additional_dependencies:
Expand Down
4 changes: 2 additions & 2 deletions src/mk/ctx.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from typing import Optional
from __future__ import annotations

from mk.runner import Runner


class Context:
def __init__(self) -> None:
self._runner: Optional[Runner] = None
self._runner: Runner | None = None

@property
def runner(self) -> Runner:
Expand Down
5 changes: 3 additions & 2 deletions src/mk/text.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

import re
from typing import Union


def strip_ansi_escape(text: Union[str, bytes]) -> str:
def strip_ansi_escape(text: str | bytes) -> str:
"""Remove all ANSI escapes from string or bytes.

If bytes is passed instead of string, it will be converted to string
Expand Down
5 changes: 3 additions & 2 deletions src/mk/tools/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ def up(self):
if result.returncode == 0:
pr_list = []
if result.stdout:
for line in result.stdout.splitlines():
pr_list.append(line.split("\t")[0])
pr_list = [
line.split("\t")[0] for line in result.stdout.splitlines()
]
if len(pr_list) == 0:
logging.debug("Existing PR not found, creating one.")
commit = repo.head.commit
Expand Down
5 changes: 3 additions & 2 deletions test/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

import os
import re
import runpy
from typing import Optional

import pytest
from subprocess_tee import run
Expand Down Expand Up @@ -39,7 +40,7 @@ def test_completion_speed(benchmark, monkeypatch) -> None:
# monkeypatch.setenv("_MK_COMPLETE", "complete_zsh")
# monkeypatch.setenv("_TYPER_COMPLETE_ARGS", "c")

def do_complete() -> Optional[int]:
def do_complete() -> int | None:
# shell execution can add considerable extra time that varies from
# system to system. We only benchmark our own module execution time
try:
Expand Down