Skip to content

Commit 0012f2e

Browse files
trivialfishcho3
andauthored
Upgrade clang-tidy on CI. (dmlc#5469)
* Correct all clang-tidy errors. * Upgrade clang-tidy to 10 on CI. Co-authored-by: Hyunsu Cho <[email protected]>
1 parent 30e94dd commit 0012f2e

File tree

107 files changed

+933
-904
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+933
-904
lines changed

.clang-tidy

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
Checks: 'modernize-*,-modernize-make-*,-modernize-use-auto,-modernize-raw-string-literal,-modernize-avoid-c-arrays,-modernize-use-trailing-return-type,google-*,-google-default-arguments,-clang-diagnostic-#pragma-messages,readability-identifier-naming'
22
CheckOptions:
3-
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
4-
- { key: readability-identifier-naming.StructCase, value: CamelCase }
5-
- { key: readability-identifier-naming.TypeAliasCase, value: CamelCase }
6-
- { key: readability-identifier-naming.TypedefCase, value: CamelCase }
7-
- { key: readability-identifier-naming.TypeTemplateParameterCase, value: CamelCase }
8-
- { key: readability-identifier-naming.MemberCase, value: lower_case }
9-
- { key: readability-identifier-naming.PrivateMemberSuffix, value: '_' }
10-
- { key: readability-identifier-naming.ProtectedMemberSuffix, value: '_' }
11-
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
12-
- { key: readability-identifier-naming.EnumConstant, value: CamelCase }
13-
- { key: readability-identifier-naming.EnumConstantPrefix, value: k }
14-
- { key: readability-identifier-naming.GlobalConstantCase, value: CamelCase }
15-
- { key: readability-identifier-naming.GlobalConstantPrefix, value: k }
16-
- { key: readability-identifier-naming.StaticConstantCase, value: CamelCase }
17-
- { key: readability-identifier-naming.StaticConstantPrefix, value: k }
18-
- { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase }
19-
- { key: readability-identifier-naming.ConstexprVariablePrefix, value: k }
20-
- { key: readability-identifier-naming.FunctionCase, value: CamelCase }
21-
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
3+
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
4+
- { key: readability-identifier-naming.StructCase, value: CamelCase }
5+
- { key: readability-identifier-naming.TypeAliasCase, value: CamelCase }
6+
- { key: readability-identifier-naming.TypedefCase, value: CamelCase }
7+
- { key: readability-identifier-naming.TypeTemplateParameterCase, value: CamelCase }
8+
- { key: readability-identifier-naming.MemberCase, value: lower_case }
9+
- { key: readability-identifier-naming.PrivateMemberSuffix, value: '_' }
10+
- { key: readability-identifier-naming.ProtectedMemberSuffix, value: '_' }
11+
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
12+
- { key: readability-identifier-naming.EnumConstant, value: CamelCase }
13+
- { key: readability-identifier-naming.EnumConstantPrefix, value: k }
14+
- { key: readability-identifier-naming.GlobalConstantCase, value: CamelCase }
15+
- { key: readability-identifier-naming.GlobalConstantPrefix, value: k }
16+
- { key: readability-identifier-naming.StaticConstantCase, value: CamelCase }
17+
- { key: readability-identifier-naming.StaticConstantPrefix, value: k }
18+
- { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase }
19+
- { key: readability-identifier-naming.ConstexprVariablePrefix, value: k }
20+
- { key: readability-identifier-naming.FunctionCase, value: CamelCase }
21+
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def ClangTidy() {
119119
echo "Running clang-tidy job..."
120120
def container_type = "clang_tidy"
121121
def docker_binary = "docker"
122-
def dockerArgs = "--build-arg CUDA_VERSION=9.2"
122+
def dockerArgs = "--build-arg CUDA_VERSION=10.1"
123123
sh """
124124
${dockerRun} ${container_type} ${docker_binary} ${dockerArgs} python3 tests/ci_build/tidy.py
125125
"""

include/xgboost/base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ using bst_uint = uint32_t; // NOLINT
106106
/*! \brief integer type. */
107107
using bst_int = int32_t; // NOLINT
108108
/*! \brief unsigned long integers */
109-
using bst_ulong = uint64_t;
109+
using bst_ulong = uint64_t; // NOLINT
110110
/*! \brief float type, used for storing statistics */
111111
using bst_float = float; // NOLINT
112112

include/xgboost/data.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,34 +42,34 @@ class MetaInfo {
4242
static constexpr uint64_t kNumField = 9;
4343

4444
/*! \brief number of rows in the data */
45-
uint64_t num_row_{0};
45+
uint64_t num_row_{0}; // NOLINT
4646
/*! \brief number of columns in the data */
47-
uint64_t num_col_{0};
47+
uint64_t num_col_{0}; // NOLINT
4848
/*! \brief number of nonzero entries in the data */
49-
uint64_t num_nonzero_{0};
49+
uint64_t num_nonzero_{0}; // NOLINT
5050
/*! \brief label of each instance */
51-
HostDeviceVector<bst_float> labels_;
51+
HostDeviceVector<bst_float> labels_; // NOLINT
5252
/*!
5353
* \brief the index of begin and end of a group
5454
* needed when the learning task is ranking.
5555
*/
56-
std::vector<bst_group_t> group_ptr_;
56+
std::vector<bst_group_t> group_ptr_; // NOLINT
5757
/*! \brief weights of each instance, optional */
58-
HostDeviceVector<bst_float> weights_;
58+
HostDeviceVector<bst_float> weights_; // NOLINT
5959
/*!
6060
* \brief initialized margins,
6161
* if specified, xgboost will start from this init margin
6262
* can be used to specify initial prediction to boost from.
6363
*/
64-
HostDeviceVector<bst_float> base_margin_;
64+
HostDeviceVector<bst_float> base_margin_; // NOLINT
6565
/*!
6666
* \brief lower bound of the label, to be used for survival analysis (censored regression)
6767
*/
68-
HostDeviceVector<bst_float> labels_lower_bound_;
68+
HostDeviceVector<bst_float> labels_lower_bound_; // NOLINT
6969
/*!
7070
* \brief upper bound of the label, to be used for survival analysis (censored regression)
7171
*/
72-
HostDeviceVector<bst_float> labels_upper_bound_;
72+
HostDeviceVector<bst_float> labels_upper_bound_; // NOLINT
7373

7474
/*! \brief default constructor */
7575
MetaInfo() = default;
@@ -360,7 +360,7 @@ class BatchIteratorImpl {
360360
template<typename T>
361361
class BatchIterator {
362362
public:
363-
using iterator_category = std::forward_iterator_tag;
363+
using iterator_category = std::forward_iterator_tag; // NOLINT
364364
explicit BatchIterator(BatchIteratorImpl<T>* impl) { impl_.reset(impl); }
365365

366366
void operator++() {
@@ -395,9 +395,9 @@ class BatchIterator {
395395
template<typename T>
396396
class BatchSet {
397397
public:
398-
explicit BatchSet(BatchIterator<T> begin_iter) : begin_iter_(begin_iter) {}
399-
BatchIterator<T> begin() { return begin_iter_; }
400-
BatchIterator<T> end() { return BatchIterator<T>(nullptr); }
398+
explicit BatchSet(BatchIterator<T> begin_iter) : begin_iter_(std::move(begin_iter)) {}
399+
BatchIterator<T> begin() { return begin_iter_; } // NOLINT
400+
BatchIterator<T> end() { return BatchIterator<T>(nullptr); } // NOLINT
401401

402402
private:
403403
BatchIterator<T> begin_iter_;

include/xgboost/feature_map.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class FeatureMap {
6565
return names_[idx].c_str();
6666
}
6767
/*! \return type of specific feature */
68-
Type type(size_t idx) const {
68+
Type TypeOf(size_t idx) const {
6969
CHECK_LT(idx, names_.size()) << "FeatureMap feature index exceed bound";
7070
return types_[idx];
7171
}

include/xgboost/generic_parameters.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct GenericParameter : public XGBoostParameter<GenericParameter> {
8989

9090
private:
9191
// number of devices to use (deprecated).
92-
int n_gpus {0};
92+
int n_gpus {0}; // NOLINT
9393
};
9494
} // namespace xgboost
9595

include/xgboost/host_device_vector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class HostDeviceVector {
130130

131131
void Resize(size_t new_size, T v = T());
132132

133-
using value_type = T;
133+
using value_type = T; // NOLINT
134134

135135
private:
136136
HostDeviceVectorImpl<T>* impl_;

0 commit comments

Comments
 (0)