Skip to content
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ repos:
- --fix
- --python=.venv/
additional_dependencies:
- ty==0.0.38
- ty==0.0.39
types:
- python
- repo: https://github.com/asottile/pyupgrade
Expand All @@ -162,7 +162,7 @@ repos:
hooks:
- id: actionlint
- repo: https://github.com/crate-ci/typos
rev: v1.46.2
rev: v1.46.3
hooks:
- id: typos
exclude_types:
Expand Down
14 changes: 11 additions & 3 deletions dev_tools/check_jira_reference_in_todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import re
import sys
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, TypedDict

from dev_tools.utils.git_hook_utils import parse_arguments

Expand All @@ -14,6 +14,14 @@
from pathlib import Path


class IncorrectTodo(TypedDict):
"""Incorrect Todo."""

file_path: Path
line_number: int
line_content: str


def line_has_incorrect_todo(line: str) -> bool:
return (
not re.compile(r"^.*(?=TODO\([A-Z]+\-[0-9]+\)\:).*").search(line)
Expand All @@ -22,8 +30,8 @@ def line_has_incorrect_todo(line: str) -> bool:
)


def find_files_with_incorrect_jira_reference_in_todo(files: list[Path]) -> list[dict[str, object]]:
incorrect_files = []
def find_files_with_incorrect_jira_reference_in_todo(files: list[Path]) -> list[IncorrectTodo]:
incorrect_files: list[IncorrectTodo] = []
for file in files:
lines = file.read_text(errors="ignore").splitlines()
for line_number, line in enumerate(lines, 1):
Expand Down