Fix clang-tidy error
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1k
- Forks
- 423
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 24
Description
Enhancement
There are still a lot of clang-tidy error in our code. In order to improve code quality, we need to fix them.
A script to detect clang-tidy error in local machine using clang-tidy:
# find_clang_tidy_error.sh
## env settings
WORKSPACE=$(cd `dirname $0`; pwd)
BUILD_DIR="build"
TIDY_BIN="/usr/bin/clang-tidy"
TIDY_SCRIPT="/path/to/tiflash/release-centos7-llvm/scripts/run-clang-tidy.py"
DIR_TO_CHECK="${1}"
command -v "${TIDY_SCRIPT}" > /dev/null 2>&1
if [[ $? == 0 ]]; then
# Check files by script, with parallel
python3 "${TIDY_SCRIPT}" -p "${WORKSPACE}/${BUILD_DIR}/" -j 4 --files "${DIR_TO_CHECK}/*"
else
# Check each file by clang-tidy
for f in $(find "${DIR_TO_CHECK}" -name '*.cpp' -o -name "*.h"); do
echo "Checking $f"
"${TIDY_BIN}" -p "${WORKSPACE}/${BUILD_DIR}/compile_commands.json" "$f"
done
fi
how to run:
./find_clang_tidy_error.sh dbms/src/Storages/DeltaMerge/tests
Be free to open a new issue like #4602 #4603 #4604, and a linked PR is warmly welcomed!
note that
clang-tidyis just a tool for static analysis, so the result ofclang-tidyis not absolutely right.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by using the provided find_clang_tidy_error.sh command with clang-tidy on a selected directory, such as dbms/src/Storages/DeltaMerge/tests. Review the reported diagnostics and address an appropriate subset of them, then rerun the command to confirm those diagnostics are resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100