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

Refactored clang version check into a python script. #1471

Merged
merged 7 commits into from
Jun 25, 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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ repos:
hooks:
- id: check-clang-format-version
name: Check clang-format version
entry: ./ci/check-clang-format-version.sh
language: script
entry: python3 ./ci/check-clang-format-version.py
language: system
- id: clang-format
name: Clang format
entry: clang-format
Expand Down
18 changes: 18 additions & 0 deletions ci/check-clang-format-version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import subprocess

EXPECTED_CLANG_VERSION = "18.1.6"


def main():
result = subprocess.run(("clang-format", "--version"), capture_output=True)
result.check_returncode()

version_str = result.stdout.decode("utf-8").split()[2].strip()
if version_str != EXPECTED_CLANG_VERSION:
raise ValueError(
f"Error: Found clang-format version {version_str}, but {EXPECTED_CLANG_VERSION} is required."
)


if __name__ == "__main__":
main()
12 changes: 0 additions & 12 deletions ci/check-clang-format-version.sh

This file was deleted.

Loading