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

Files without shebang have mime 'text/plain' or 'inode/x-empty' #64062

Merged
merged 1 commit into from
May 17, 2024
Merged
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
5 changes: 3 additions & 2 deletions tests/ci/style_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from typing import List, Tuple, Union

import magic

from docker_images_helper import get_docker_image, pull_image
from env_helper import CI, REPO_COPY, TEMP_PATH
from git_helper import GIT_PREFIX, git_runner
Expand Down Expand Up @@ -121,12 +122,12 @@ def _check_mime(file: Union[Path, str], mime: str) -> bool:

def is_python(file: Union[Path, str]) -> bool:
"""returns if the changed file in the repository is python script"""
return _check_mime(file, "text/x-script.python")
return _check_mime(file, "text/x-script.python") or str(file).endswith(".py")


def is_shell(file: Union[Path, str]) -> bool:
"""returns if the changed file in the repository is shell script"""
return _check_mime(file, "text/x-shellscript")
return _check_mime(file, "text/x-shellscript") or str(file).endswith(".sh")


def main():
Expand Down
Loading