Skip to content

Commit 9bde1a4

Browse files
authored
chore: fix clang-tidy error and improve clang-tidy in workflow (#35)
1 parent 670a294 commit 9bde1a4

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

.github/workflows/clang_test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
4141
with:
4242
lfs: true
43+
fetch-depth: 0 # fetch all history for git diff in clang-tidy
4344
- name: Build Paimon
4445
shell: bash
4546
env:

cmake_modules/DefineOptions.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
117117
"If on, only git-diff files will be passed to linting tools" ON)
118118

119119
define_option_string(PAIMON_LINT_GIT_TARGET_COMMIT
120-
"target commit/branch for comparison in git diff" "HEAD")
120+
"target commit/branch for comparison in git diff" "origin/main")
121121

122122
define_option(PAIMON_GENERATE_COVERAGE "Build with C++ code coverage enabled" OFF)
123123

src/paimon/common/global_index/global_index_result.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,13 @@ Result<std::vector<Range>> GlobalIndexResult::ToRanges() const {
148148
// Extend the current range
149149
range_end = current;
150150
} else {
151-
ranges.push_back(Range(range_start, range_end));
151+
ranges.emplace_back(range_start, range_end);
152152
range_start = current;
153153
range_end = current;
154154
}
155155
}
156156
// Add the last range
157-
ranges.push_back(Range(range_start, range_end));
157+
ranges.emplace_back(range_start, range_end);
158158
return ranges;
159159
}
160160

src/paimon/common/utils/range.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ std::vector<Range> Range::Exclude(const std::vector<Range>& ranges) const {
122122
}
123123
// Add the part before the intersection (if any)
124124
if (current < intersect.value().from) {
125-
result.push_back(Range(current, intersect.value().from - 1));
125+
result.emplace_back(current, intersect.value().from - 1);
126126
}
127127
// Move current position past the intersection
128128
current = intersect.value().to + 1;
@@ -132,7 +132,7 @@ std::vector<Range> Range::Exclude(const std::vector<Range>& ranges) const {
132132
}
133133
// Add the remaining part after all exclusions (if any)
134134
if (current <= to) {
135-
result.push_back(Range(current, to));
135+
result.emplace_back(current, to);
136136
}
137137

138138
return result;

0 commit comments

Comments
 (0)