-
Notifications
You must be signed in to change notification settings - Fork 69
[CI] Add clang-tidy check with clang-analyzer and performance checks #490
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
Draft
BewareMyPower
wants to merge
28
commits into
apache:main
Choose a base branch
from
BewareMyPower:bewaremypower/clang-tidy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
6d74e9e
[CI] Add clang-tidy check
BewareMyPower 4c52c47
add license
BewareMyPower e5d91e0
fix clang-tidy directory
BewareMyPower b39bd89
Add a script to run clang-tidy on specific files
BewareMyPower 537f13b
Fix lint errors by the clang-analyzer checks
BewareMyPower 1289dcb
(WIP) Add performance check
BewareMyPower 27c1a99
Remove all unnecessary callbacks
BewareMyPower 80ca91a
fix clang-tidy check
BewareMyPower 835e1ca
Revert license change
BewareMyPower 9b0c261
Fix missed headers
BewareMyPower be034db
Fix missed headers
BewareMyPower 325d05c
Fix clang-tidy
BewareMyPower 69f45a1
Speed up CI
BewareMyPower aaebd30
Fix triplet
BewareMyPower 670124f
export compile_commands.json
BewareMyPower 4c37ad8
Fix invalid memory access for UnAckedMessageTrackerEnabled and Consum…
BewareMyPower c9ab527
Use single thread for run-clang-tidy
BewareMyPower 42bcc58
Fix AckGroupingTracker not flushed during close
BewareMyPower 8ad42f3
Fix clang-tidy error
BewareMyPower 0beeb4f
Fix NPE in BasicEndToEndTest.testEncryptionFailure
BewareMyPower 063f265
Upgrade test image to use clang-tidy 17
BewareMyPower dd2f7d2
Fix Method called on moved-from object 'listeners_' of type 'std::for…
BewareMyPower 3a793de
Try fixing lint errors
BewareMyPower e310f53
Fix Windows build
BewareMyPower b57c81a
Fix clang-tidy failures caused by boost::algorithm::split and asio::i…
BewareMyPower 7a979eb
Run clang-tidy in parallel
BewareMyPower de8d5f5
Fix comments
BewareMyPower 85b27f6
Fix run_clang_tidy.sh not work on macOS
BewareMyPower 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 hidden or 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,32 @@ | ||
# 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. | ||
|
||
--- | ||
# TODO: add more checks | ||
# - bugprone | ||
# - cppcoreguidelines | ||
# - portability | ||
# - readability | ||
Checks: > | ||
-*, | ||
clang-analyzer-*, | ||
-clang-analyzer-security.insecureAPI.rand, | ||
performance-*, | ||
-performance-inefficient-string-concatenation | ||
WarningsAsErrors: '*' | ||
HeaderFilterRegex: '^(?!.*PulsarApi\.pb\.h$).*$' | ||
FormatStyle: none |
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -106,3 +106,6 @@ Testing | |
.test-token.txt | ||
pkg/mac/.build | ||
pkg/mac/.install | ||
|
||
# Used in ./build-support/run_clang_tidy.sh | ||
files.txt |
This file contains hidden or 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 hidden or 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,40 @@ | ||
#!/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 | ||
cd `dirname $0`/.. | ||
|
||
FILES=$(find $PWD/include $PWD/lib $PWD/tests $PWD/examples -name "*.h" -o -name "*.cc" \ | ||
| grep -v "lib\/c\/" | grep -v "lib\/checksum\/" | grep -v "lib\/lz4\/" \ | ||
| grep -v "include\/pulsar\/c\/" | grep -v "tests\/c\/") | ||
|
||
rm -f files.txt | ||
for FILE in $FILES; do | ||
echo $FILE >> files.txt | ||
done | ||
# run-clang-tidy from older version of LLVM requires python but not python3 as the env, so we cannot run it directly | ||
SCRIPT=$(which run-clang-tidy) | ||
set +e | ||
nproc | ||
if [[ $? == 0 ]]; then | ||
python3 $SCRIPT -p build -j$(nproc) $(cat files.txt) | ||
else | ||
python3 $SCRIPT -p build -j8 $(cat files.txt) | ||
fi | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -21,6 +21,8 @@ | |
|
||
#include <pulsar/Logger.h> | ||
|
||
#include <memory> | ||
|
||
namespace pulsar { | ||
|
||
class ConsoleLoggerFactoryImpl; | ||
|
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.
Should we delete the
files.txt
here?