Add pyproject.toml to is_python for style checks

This commit is contained in:
Mikhail f. Shiryaev 2024-09-26 14:55:01 +02:00
parent 4955aa82f0
commit 117a846f87
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4

View File

@ -13,17 +13,17 @@ from typing import List, Tuple, Union
import magic import magic
from docker_images_helper import get_docker_image, pull_image from docker_images_helper import get_docker_image, pull_image
from env_helper import IS_CI, REPO_COPY, TEMP_PATH, GITHUB_EVENT_PATH from env_helper import GITHUB_EVENT_PATH, IS_CI, REPO_COPY, TEMP_PATH
from git_helper import GIT_PREFIX, git_runner from git_helper import GIT_PREFIX, git_runner
from pr_info import PRInfo from pr_info import PRInfo
from report import ( from report import (
ERROR, ERROR,
FAIL,
FAILURE, FAILURE,
SUCCESS, SUCCESS,
JobReport, JobReport,
TestResults, TestResults,
read_test_results, read_test_results,
FAIL,
) )
from ssh import SSHKey from ssh import SSHKey
from stopwatch import Stopwatch from stopwatch import Stopwatch
@ -130,7 +130,11 @@ def _check_mime(file: Union[Path, str], mime: str) -> bool:
def is_python(file: Union[Path, str]) -> bool: def is_python(file: Union[Path, str]) -> bool:
"""returns if the changed file in the repository is python script""" """returns if the changed file in the repository is python script"""
return _check_mime(file, "text/x-script.python") or str(file).endswith(".py") return (
_check_mime(file, "text/x-script.python")
or str(file).endswith(".py")
or str(file) == "pyproject.toml"
)
def is_shell(file: Union[Path, str]) -> bool: def is_shell(file: Union[Path, str]) -> bool: