-
Notifications
You must be signed in to change notification settings - Fork 38
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
chore(ci): Add clang-tidy checks and ensure they pass #639
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
e1545db
start again
paleolimbot 0093dd0
fix two more clang-tidy warnings
paleolimbot 240f0c3
ignore dead store
paleolimbot 681094c
dcheck for number of decimal words
paleolimbot 80cfc9b
add dcheck
paleolimbot beaef47
dev
paleolimbot cefedda
sort non-flatcc
paleolimbot e80beb7
maybe add ci job
paleolimbot cd19965
typo
paleolimbot d2f6bc1
remove old file
paleolimbot d2f5b10
whoops
paleolimbot 39e0316
better name
paleolimbot fbe88d0
maybe simplify and ensure build errors
paleolimbot 099258b
see if this does it
paleolimbot 00fb6ad
fix device errors
paleolimbot 64f5a4c
see if this errors
paleolimbot 76370fd
basic level of erroring for errors
paleolimbot 84b555e
fix file
paleolimbot f049c12
one more from macos
paleolimbot f6cabcb
fix a metal one
paleolimbot e7d4ef5
ensure clang-tidy script works on macos
paleolimbot b7ce2bf
maybe fix clang-tidy
paleolimbot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
--- | ||
# Disable valist, it's buggy: https://github.com/llvm/llvm-project/issues/40656 | ||
# Disable DeprecatedOrUnsafeBufferHandling because it suggests we replace | ||
# memset and memcpy with memset_s() and memcpy_s() if compiled with C11. Because | ||
# we also support C99, we can't blindly replace those calls. | ||
Checks: '-clang-analyzer-valist.Uninitialized,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling' | ||
FormatStyle: google |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
name: clang-tidy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'CMakeLists.txt' | ||
- '.github/workflows/clang-tidy.yaml' | ||
- 'src/nanoarrow/**' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
clang-tidy: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
name: ${{ matrix.config.label }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Cache Arrow C++ Build | ||
id: cache-arrow-build | ||
uses: actions/cache@v4 | ||
with: | ||
path: arrow | ||
# Bump the number at the end of this line to force a new Arrow C++ build | ||
key: arrow-${{ runner.os }}-${{ runner.arch }}-1 | ||
|
||
- name: Build Arrow C++ | ||
if: steps.cache-arrow-build.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: | | ||
ci/scripts/build-arrow-cpp-minimal.sh 15.0.2 arrow | ||
|
||
- name: Build nanoarrow | ||
run: | | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/dist/lib | ||
sudo ldconfig | ||
|
||
ARROW_PATH="$(pwd)/arrow" | ||
mkdir build | ||
cd build | ||
|
||
cmake .. -DNANOARROW_DEVICE=ON -DNANOARROW_IPC=ON \ | ||
-DNANOARROW_BUILD_TESTS=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ | ||
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | ||
-DCMAKE_PREFIX_PATH="${ARROW_PATH}" | ||
|
||
cmake --build . | ||
|
||
- name: Run clang-tidy | ||
run: | | ||
ci/scripts/run-clang-tidy.sh . build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
set -e | ||
|
||
main() { | ||
local -r source_dir="${1}" | ||
local -r build_dir="${2}" | ||
|
||
if [ $(uname) = "Darwin" ]; then | ||
local -r jobs=$(sysctl -n hw.ncpu) | ||
else | ||
local -r jobs=$(nproc) | ||
fi | ||
|
||
set -x | ||
|
||
run-clang-tidy -p "${build_dir}" -j$jobs \ | ||
-extra-arg=-Wno-unknown-warning-option | \ | ||
tee "${build_dir}/clang-tidy-output.txt" | ||
|
||
if grep -e "warning:" -e "error:" "${build_dir}/clang-tidy-output.txt"; then | ||
echo "Warnings or errors found!" | ||
exit 1 | ||
else | ||
echo "No warnings or errors found!" | ||
fi | ||
|
||
set +x | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since
bits
is a parameter this might also be a good use case for the clang/gcc nonnull attributeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know about that! I think it can be NULL if
length == 0
here but there are other places where it could be useful!