Skip to content

Commit 544d439

Browse files
authored
[ci] update pre-commit hooks, fix typos (#7108)
* [ci] update pre-commit hooks, fix typos * remove unnecessary indentation settings in biome.json
1 parent 52659d4 commit 544d439

File tree

9 files changed

+56
-30
lines changed

9 files changed

+56
-30
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ exclude: |
1313
1414
repos:
1515
- repo: https://github.com/pre-commit/pre-commit-hooks
16-
rev: v5.0.0
16+
rev: v6.0.0
1717
hooks:
18+
- id: check-toml
19+
- id: check-xml
1820
- id: end-of-file-fixer
1921
- id: trailing-whitespace
2022
- repo: https://github.com/cmake-lint/cmake-lint
@@ -63,7 +65,7 @@ repos:
6365
- sphinx>=8.1.3
6466
- sphinx_rtd_theme>=3.0.1
6567
- repo: https://github.com/astral-sh/ruff-pre-commit
66-
rev: v0.14.0
68+
rev: v0.14.10
6769
hooks:
6870
- id: ruff-check
6971
args: ["--config", "python-package/pyproject.toml"]
@@ -72,30 +74,30 @@ repos:
7274
args: ["--config", "python-package/pyproject.toml"]
7375
types_or: [python, jupyter]
7476
- repo: https://github.com/biomejs/pre-commit
75-
rev: v2.2.5
77+
rev: v2.3.10
7678
hooks:
7779
- id: biome-ci
7880
args:
7981
- --config-path=./biome.json
8082
- --diagnostic-level=info
8183
- --error-on-warnings
8284
- repo: https://github.com/shellcheck-py/shellcheck-py
83-
rev: v0.10.0.1
85+
rev: v0.11.0.1
8486
hooks:
8587
- id: shellcheck
8688
- repo: https://github.com/crate-ci/typos
87-
rev: v1.34.0
89+
rev: v1.40.0
8890
hooks:
8991
- id: typos
9092
args: ["--force-exclude"]
9193
exclude: (\.gitignore$)|(^\.editorconfig$)
9294
- repo: https://github.com/henryiii/validate-pyproject-schema-store
93-
rev: 2025.07.14
95+
rev: 2025.11.21
9496
hooks:
9597
- id: validate-pyproject
9698
files: python-package/pyproject.toml$
9799
- repo: https://github.com/pre-commit/mirrors-mypy
98-
rev: v1.18.2
100+
rev: v1.19.1
99101
hooks:
100102
- id: mypy
101103
verbose: true

.typos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ default.extend-ignore-re = [
88
[default.extend-words]
99
MAPE = "MAPE"
1010
datas = "datas"
11+
indx = "indx"
1112
interprete = "interprete"
1213
mape = "mape"
1314
splitted = "splitted"

R-package/demo/cross_validation.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ lgb.cv(
3838
, showsd = FALSE
3939
)
4040

41-
# You can also do cross validation with cutomized loss function
41+
# You can also do cross validation with customized loss function
4242
print("Running cross validation, with cutomsized loss function")
4343

4444
logregobj <- function(preds, dtrain) {

biome.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@
55
"clientKind": "git",
66
"useIgnoreFile": true
77
},
8+
"files": {
9+
"includes": [
10+
"**",
11+
"!build",
12+
"!external_libs",
13+
"!lightgbm-python",
14+
"!lightgbm_r"
15+
]
16+
},
817
"formatter": {
918
"enabled": true,
19+
"expand": "always",
1020
"useEditorconfig": true,
1121
"lineWidth": 120
1222
},
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
[
22
{
33
"feature": 0,
4-
"bin_upper_bound": [0.3, 0.35, 0.4]
4+
"bin_upper_bound": [
5+
0.3,
6+
0.35,
7+
0.4
8+
]
59
},
610
{
711
"feature": 1,
8-
"bin_upper_bound": [-0.1, -0.15, -0.2]
12+
"bin_upper_bound": [
13+
-0.1,
14+
-0.15,
15+
-0.2
16+
]
917
}
1018
]
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
[
22
{
33
"feature": 0,
4-
"bin_upper_bound": [0.19, 0.39, 0.59, 0.79]
4+
"bin_upper_bound": [
5+
0.19,
6+
0.39,
7+
0.59,
8+
0.79
9+
]
510
}
611
]

include/LightGBM/dataset.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ class Dataset {
645645
inline int Feature2Group(int feature_idx) const {
646646
return feature2group_[feature_idx];
647647
}
648-
inline int Feture2SubFeature(int feature_idx) const {
648+
inline int Feature2SubFeature(int feature_idx) const {
649649
return feature2subfeature_[feature_idx];
650650
}
651651
inline uint64_t GroupBinBoundary(int group_idx) const {

src/c_api.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -922,10 +922,10 @@ using LightGBM::SingleRowPredictor;
922922
// some help functions used to convert data
923923

924924
std::function<std::vector<double>(int row_idx)>
925-
RowFunctionFromDenseMatric(const void* data, int num_row, int num_col, int data_type, int is_row_major);
925+
RowFunctionFromDenseMatrix(const void* data, int num_row, int num_col, int data_type, int is_row_major);
926926

927927
std::function<std::vector<std::pair<int, double>>(int row_idx)>
928-
RowPairFunctionFromDenseMatric(const void* data, int num_row, int num_col, int data_type, int is_row_major);
928+
RowPairFunctionFromDenseMatrix(const void* data, int num_row, int num_col, int data_type, int is_row_major);
929929

930930
std::function<std::vector<std::pair<int, double>>(int row_idx)>
931931
RowPairFunctionFromDenseRows(const void** data, int num_col, int data_type);
@@ -1140,7 +1140,7 @@ int LGBM_DatasetPushRows(DatasetHandle dataset,
11401140
int32_t start_row) {
11411141
API_BEGIN();
11421142
auto p_dataset = reinterpret_cast<Dataset*>(dataset);
1143-
auto get_row_fun = RowFunctionFromDenseMatric(data, nrow, ncol, data_type, 1);
1143+
auto get_row_fun = RowFunctionFromDenseMatrix(data, nrow, ncol, data_type, 1);
11441144
if (p_dataset->has_raw()) {
11451145
p_dataset->ResizeRaw(p_dataset->num_numeric_features() + nrow);
11461146
}
@@ -1179,7 +1179,7 @@ int LGBM_DatasetPushRowsWithMetadata(DatasetHandle dataset,
11791179
Log::Fatal("data cannot be null.");
11801180
}
11811181
auto p_dataset = reinterpret_cast<Dataset*>(dataset);
1182-
auto get_row_fun = RowFunctionFromDenseMatric(data, nrow, ncol, data_type, 1);
1182+
auto get_row_fun = RowFunctionFromDenseMatrix(data, nrow, ncol, data_type, 1);
11831183
if (p_dataset->has_raw()) {
11841184
p_dataset->ResizeRaw(p_dataset->num_numeric_features() + nrow);
11851185
}
@@ -1344,7 +1344,7 @@ int LGBM_DatasetCreateFromMats(int32_t nmat,
13441344

13451345
std::vector<std::function<std::vector<double>(int row_idx)>> get_row_fun;
13461346
for (int j = 0; j < nmat; ++j) {
1347-
get_row_fun.push_back(RowFunctionFromDenseMatric(data[j], nrow[j], ncol, data_type, is_row_major[j]));
1347+
get_row_fun.push_back(RowFunctionFromDenseMatrix(data[j], nrow[j], ncol, data_type, is_row_major[j]));
13481348
}
13491349

13501350
if (reference == nullptr) {
@@ -1614,7 +1614,7 @@ int LGBM_DatasetCreateFromCSC(const void* col_ptr,
16141614
continue;
16151615
}
16161616
int group = ret->Feature2Group(feature_idx);
1617-
int sub_feature = ret->Feture2SubFeature(feature_idx);
1617+
int sub_feature = ret->Feature2SubFeature(feature_idx);
16181618
CSC_RowIterator col_it(col_ptr, col_ptr_type, indices, data, data_type, ncol_ptr, nelem, i);
16191619
auto bin_mapper = ret->FeatureBinMapper(feature_idx);
16201620
if (bin_mapper->GetDefaultBin() == bin_mapper->GetMostFreqBin()) {
@@ -2531,7 +2531,7 @@ int LGBM_BoosterPredictForMat(BoosterHandle handle,
25312531
config.Set(param);
25322532
OMP_SET_NUM_THREADS(config.num_threads);
25332533
Booster* ref_booster = reinterpret_cast<Booster*>(handle);
2534-
auto get_row_fun = RowPairFunctionFromDenseMatric(data, nrow, ncol, data_type, is_row_major);
2534+
auto get_row_fun = RowPairFunctionFromDenseMatrix(data, nrow, ncol, data_type, is_row_major);
25352535
ref_booster->Predict(start_iteration, num_iteration, predict_type, nrow, ncol, get_row_fun,
25362536
config, out_result, out_len);
25372537
API_END();
@@ -2554,7 +2554,7 @@ int LGBM_BoosterPredictForMatSingleRow(BoosterHandle handle,
25542554
config.Set(param);
25552555
OMP_SET_NUM_THREADS(config.num_threads);
25562556
Booster* ref_booster = reinterpret_cast<Booster*>(handle);
2557-
auto get_row_fun = RowPairFunctionFromDenseMatric(data, 1, ncol, data_type, is_row_major);
2557+
auto get_row_fun = RowPairFunctionFromDenseMatrix(data, 1, ncol, data_type, is_row_major);
25582558
ref_booster->SetSingleRowPredictorInner(start_iteration, num_iteration, predict_type, config);
25592559
ref_booster->PredictSingleRow(predict_type, ncol, get_row_fun, config, out_result, out_len);
25602560
API_END();
@@ -2587,7 +2587,7 @@ int LGBM_BoosterPredictForMatSingleRowFast(FastConfigHandle fastConfig_handle,
25872587
API_BEGIN();
25882588
SingleRowPredictor *single_row_predictor = reinterpret_cast<SingleRowPredictor*>(fastConfig_handle);
25892589
// Single row in row-major format:
2590-
auto get_row_fun = RowPairFunctionFromDenseMatric(data, 1, single_row_predictor->num_cols, single_row_predictor->data_type, 1);
2590+
auto get_row_fun = RowPairFunctionFromDenseMatrix(data, 1, single_row_predictor->num_cols, single_row_predictor->data_type, 1);
25912591
single_row_predictor->Predict(get_row_fun, out_result, out_len);
25922592
API_END();
25932593
}
@@ -2819,7 +2819,7 @@ int LGBM_GetMaxThreads(int* out) {
28192819

28202820
template<typename T>
28212821
std::function<std::vector<double>(int row_idx)>
2822-
RowFunctionFromDenseMatric_helper(const void* data, int num_row, int num_col, int is_row_major) {
2822+
RowFunctionFromDenseMatrix_helper(const void* data, int num_row, int num_col, int is_row_major) {
28232823
const T* data_ptr = reinterpret_cast<const T*>(data);
28242824
if (is_row_major) {
28252825
return [=] (int row_idx) {
@@ -2842,19 +2842,19 @@ RowFunctionFromDenseMatric_helper(const void* data, int num_row, int num_col, in
28422842
}
28432843

28442844
std::function<std::vector<double>(int row_idx)>
2845-
RowFunctionFromDenseMatric(const void* data, int num_row, int num_col, int data_type, int is_row_major) {
2845+
RowFunctionFromDenseMatrix(const void* data, int num_row, int num_col, int data_type, int is_row_major) {
28462846
if (data_type == C_API_DTYPE_FLOAT32) {
2847-
return RowFunctionFromDenseMatric_helper<float>(data, num_row, num_col, is_row_major);
2847+
return RowFunctionFromDenseMatrix_helper<float>(data, num_row, num_col, is_row_major);
28482848
} else if (data_type == C_API_DTYPE_FLOAT64) {
2849-
return RowFunctionFromDenseMatric_helper<double>(data, num_row, num_col, is_row_major);
2849+
return RowFunctionFromDenseMatrix_helper<double>(data, num_row, num_col, is_row_major);
28502850
}
2851-
Log::Fatal("Unknown data type in RowFunctionFromDenseMatric");
2851+
Log::Fatal("Unknown data type in RowFunctionFromDenseMatrix");
28522852
return nullptr;
28532853
}
28542854

28552855
std::function<std::vector<std::pair<int, double>>(int row_idx)>
2856-
RowPairFunctionFromDenseMatric(const void* data, int num_row, int num_col, int data_type, int is_row_major) {
2857-
auto inner_function = RowFunctionFromDenseMatric(data, num_row, num_col, data_type, is_row_major);
2856+
RowPairFunctionFromDenseMatrix(const void* data, int num_row, int num_col, int data_type, int is_row_major) {
2857+
auto inner_function = RowFunctionFromDenseMatrix(data, num_row, num_col, data_type, is_row_major);
28582858
if (inner_function != nullptr) {
28592859
return [inner_function] (int row_idx) {
28602860
auto raw_values = inner_function(row_idx);
@@ -2875,7 +2875,7 @@ RowPairFunctionFromDenseMatric(const void* data, int num_row, int num_col, int d
28752875
std::function<std::vector<std::pair<int, double>>(int row_idx)>
28762876
RowPairFunctionFromDenseRows(const void** data, int num_col, int data_type) {
28772877
return [=](int row_idx) {
2878-
auto inner_function = RowFunctionFromDenseMatric(data[row_idx], 1, num_col, data_type, /* is_row_major */ true);
2878+
auto inner_function = RowFunctionFromDenseMatrix(data[row_idx], 1, num_col, data_type, /* is_row_major */ true);
28792879
auto raw_values = inner_function(0);
28802880
std::vector<std::pair<int, double>> ret;
28812881
ret.reserve(raw_values.size());

src/treelearner/voting_parallel_tree_learner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ void VotingParallelTreeLearner<TREELEARNER_T>::FindBestSplits(const Tree* tree)
389389
std::vector<int> smaller_top_features, larger_top_features;
390390
GlobalVoting(this->smaller_leaf_splits_->leaf_index(), smaller_top_k_splits_global, &smaller_top_features);
391391
GlobalVoting(this->larger_leaf_splits_->leaf_index(), larger_top_k_splits_global, &larger_top_features);
392-
// copy local histgrams to buffer
392+
// copy local histograms to buffer
393393
CopyLocalHistogram(smaller_top_features, larger_top_features);
394394

395395
// Reduce scatter for histogram

0 commit comments

Comments
 (0)