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

fix(ci): remove invalid --version=14 clang-format argument #1462

Merged
merged 3 commits into from
Jan 15, 2024

Conversation

kou
Copy link
Member

@kou kou commented Jan 13, 2024

Fixes #1461.

@kou
Copy link
Member Author

kou commented Jan 14, 2024

We may want to use the official(?) clang-format plugin https://github.com/pre-commit/mirrors-clang-format :

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index c13ad362..3cfd2924 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -39,12 +39,13 @@ repos:
       files: '\.(bat|sln)$'
     - id: trailing-whitespace
       exclude: "^r/.*?/_snaps/.*?.md$"
-  - repo: https://github.com/pocc/pre-commit-hooks
-    rev: v1.3.5
+  - repo: https://github.com/pre-commit/mirrors-clang-format
+    rev: "v14.0.6"
     hooks:
       - id: clang-format
-        args: [-i]
-        types_or: [c, c++]
+        types_or:
+          - c++
+          - c
   - repo: https://github.com/cheshirekow/cmake-format-precommit
     rev: v0.6.13
     hooks:

@kou
Copy link
Member Author

kou commented Jan 14, 2024

https://github.com/pocc/pre-commit-hooks doesn't work if clang-format in $PATH isn't clang-format 14. But https://github.com/pre-commit/mirrors-clang-format works even when clang-format in $PATH isn't clang-format 14 because it installs clang-format from PyPI internally.

@@ -477,7 +474,7 @@ class PostgresCopyTimestampFieldWriter : public PostgresCopyFieldWriter {
return ADBC_STATUS_INVALID_ARGUMENT;
}

if (value < std::numeric_limits<int64_t>::min() + kPostgresTimestampEpoch) {
if (value < (std::numeric_limits<int64_t>::min)() + kPostgresTimestampEpoch) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for avoiding name conflict on Windows.
windef.h defines min macro. It conflicts with std::numeric_limits::min(). If we use (std::numeric_limits::min)(), we can avoid the min macro expansion.

@@ -476,7 +476,7 @@ struct BindStream {
return ADBC_STATUS_INVALID_ARGUMENT;
}

if (val < std::numeric_limits<int64_t>::min() + kPostgresTimestampEpoch) {
if (val < (std::numeric_limits<int64_t>::min)() + kPostgresTimestampEpoch) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Kou!

@lidavidm lidavidm merged commit 6d7d93c into apache:main Jan 15, 2024
54 checks passed
@kou kou deleted the ci-clang-format branch January 15, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ci: clang-format pre-commit doesn't work
2 participants