Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
4b64b173
Unverified
Commit
4b64b173
authored
Jun 23, 2022
by
CuriousCorrelation
Committed by
GitHub
Jun 22, 2022
Browse files
[ci] [R-package] Add paste_linter (#5320)
[ci] [R-package] Add paste_linter (#5303)
parent
feb4cf4f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
14 deletions
+12
-14
.ci/lint_r_code.R
.ci/lint_r_code.R
+1
-0
R-package/R/lgb.Booster.R
R-package/R/lgb.Booster.R
+3
-3
R-package/R/lgb.Dataset.R
R-package/R/lgb.Dataset.R
+2
-2
R-package/R/lgb.Predictor.R
R-package/R/lgb.Predictor.R
+1
-3
R-package/R/lgb.convert_with_rules.R
R-package/R/lgb.convert_with_rules.R
+1
-2
R-package/tests/testthat/test_Predictor.R
R-package/tests/testthat/test_Predictor.R
+2
-2
build_r.R
build_r.R
+2
-2
No files found.
.ci/lint_r_code.R
View file @
4b64b173
...
@@ -50,6 +50,7 @@ LINTERS_TO_USE <- list(
...
@@ -50,6 +50,7 @@ LINTERS_TO_USE <- list(
,
"numeric_leading_zero"
=
lintr
::
numeric_leading_zero_linter
()
,
"numeric_leading_zero"
=
lintr
::
numeric_leading_zero_linter
()
,
"outer_negation"
=
lintr
::
outer_negation_linter
()
,
"outer_negation"
=
lintr
::
outer_negation_linter
()
,
"package_hooks"
=
lintr
::
package_hooks_linter
()
,
"package_hooks"
=
lintr
::
package_hooks_linter
()
,
"paste"
=
lintr
::
paste_linter
()
,
"regex_subset"
=
lintr
::
regex_subset_linter
()
,
"regex_subset"
=
lintr
::
regex_subset_linter
()
,
"semicolon"
=
lintr
::
semicolon_linter
()
,
"semicolon"
=
lintr
::
semicolon_linter
()
,
"seq"
=
lintr
::
seq_linter
()
,
"seq"
=
lintr
::
seq_linter
()
...
...
R-package/R/lgb.Booster.R
View file @
4b64b173
...
@@ -824,7 +824,7 @@ predict.lgb.Booster <- function(object,
...
@@ -824,7 +824,7 @@ predict.lgb.Booster <- function(object,
}
}
warning
(
paste0
(
warning
(
paste0
(
"predict.lgb.Booster: Found the following passed through '...': "
"predict.lgb.Booster: Found the following passed through '...': "
,
paste
(
names
(
additional_params
)
,
collapse
=
", "
)
,
toString
(
names
(
additional_params
))
,
". These are ignored. Use argument 'params' instead."
,
". These are ignored. Use argument 'params' instead."
))
))
}
}
...
@@ -1131,7 +1131,7 @@ lgb.get.eval.result <- function(booster, data_name, eval_name, iters = NULL, is_
...
@@ -1131,7 +1131,7 @@ lgb.get.eval.result <- function(booster, data_name, eval_name, iters = NULL, is_
"lgb.get.eval.result: data_name "
"lgb.get.eval.result: data_name "
,
shQuote
(
data_name
)
,
shQuote
(
data_name
)
,
" not found. Only the following datasets exist in record evals: ["
,
" not found. Only the following datasets exist in record evals: ["
,
paste
(
data_names
,
collapse
=
", "
)
,
toString
(
data_names
)
,
"]"
,
"]"
))
))
}
}
...
@@ -1145,7 +1145,7 @@ lgb.get.eval.result <- function(booster, data_name, eval_name, iters = NULL, is_
...
@@ -1145,7 +1145,7 @@ lgb.get.eval.result <- function(booster, data_name, eval_name, iters = NULL, is_
,
" not found. Only the following eval_names exist for dataset "
,
" not found. Only the following eval_names exist for dataset "
,
shQuote
(
data_name
)
,
shQuote
(
data_name
)
,
": ["
,
": ["
,
paste
(
eval_names
,
collapse
=
", "
)
,
toString
(
eval_names
)
,
"]"
,
"]"
))
))
stop
(
"lgb.get.eval.result: wrong eval name"
)
stop
(
"lgb.get.eval.result: wrong eval name"
)
...
...
R-package/R/lgb.Dataset.R
View file @
4b64b173
...
@@ -471,7 +471,7 @@ Dataset <- R6::R6Class(
...
@@ -471,7 +471,7 @@ Dataset <- R6::R6Class(
if
(
!
is.character
(
field_name
)
||
length
(
field_name
)
!=
1L
||
!
field_name
%in%
.INFO_KEYS
())
{
if
(
!
is.character
(
field_name
)
||
length
(
field_name
)
!=
1L
||
!
field_name
%in%
.INFO_KEYS
())
{
stop
(
stop
(
"Dataset$get_field(): field_name must one of the following: "
"Dataset$get_field(): field_name must one of the following: "
,
paste0
(
sQuote
(
.INFO_KEYS
())
,
collapse
=
", "
)
,
toString
(
sQuote
(
.INFO_KEYS
()))
)
)
}
}
...
@@ -523,7 +523,7 @@ Dataset <- R6::R6Class(
...
@@ -523,7 +523,7 @@ Dataset <- R6::R6Class(
if
(
!
is.character
(
field_name
)
||
length
(
field_name
)
!=
1L
||
!
field_name
%in%
.INFO_KEYS
())
{
if
(
!
is.character
(
field_name
)
||
length
(
field_name
)
!=
1L
||
!
field_name
%in%
.INFO_KEYS
())
{
stop
(
stop
(
"Dataset$set_field(): field_name must one of the following: "
"Dataset$set_field(): field_name must one of the following: "
,
paste0
(
sQuote
(
.INFO_KEYS
())
,
collapse
=
", "
)
,
toString
(
sQuote
(
.INFO_KEYS
()))
)
)
}
}
...
...
R-package/R/lgb.Predictor.R
View file @
4b64b173
...
@@ -224,9 +224,7 @@ Predictor <- R6::R6Class(
...
@@ -224,9 +224,7 @@ Predictor <- R6::R6Class(
,
"dsparseVector"
,
"dsparseVector"
,
"dgRMatrix"
,
"dgRMatrix"
,
"dgCMatrix"
,
"dgCMatrix"
,
paste
(
class
(
data
)
,
toString
(
class
(
data
))))
,
collapse
=
", "
)))
}
}
if
(
NROW
(
row.names
(
data
)))
{
if
(
NROW
(
row.names
(
data
)))
{
...
...
R-package/R/lgb.convert_with_rules.R
View file @
4b64b173
...
@@ -20,14 +20,13 @@
...
@@ -20,14 +20,13 @@
column_classes
<-
.get_column_classes
(
df
=
df
)
column_classes
<-
.get_column_classes
(
df
=
df
)
unconverted_columns
<-
column_classes
[
!
(
column_classes
%in%
c
(
"numeric"
,
"integer"
))]
unconverted_columns
<-
column_classes
[
!
(
column_classes
%in%
c
(
"numeric"
,
"integer"
))]
if
(
length
(
unconverted_columns
)
>
0L
)
{
if
(
length
(
unconverted_columns
)
>
0L
)
{
col_detail_string
<-
paste0
(
col_detail_string
<-
toString
(
paste0
(
paste0
(
names
(
unconverted_columns
)
names
(
unconverted_columns
)
,
" ("
,
" ("
,
unconverted_columns
,
unconverted_columns
,
")"
,
")"
)
)
,
collapse
=
", "
)
)
msg
<-
paste0
(
msg
<-
paste0
(
function_name
function_name
...
...
R-package/tests/testthat/test_Predictor.R
View file @
4b64b173
...
@@ -437,7 +437,7 @@ test_that("predict() keeps row names from data (binary classification)", {
...
@@ -437,7 +437,7 @@ test_that("predict() keeps row names from data (binary classification)", {
data
(
agaricus.train
,
package
=
"lightgbm"
)
data
(
agaricus.train
,
package
=
"lightgbm"
)
X
<-
as.matrix
(
agaricus.train
$
data
)
X
<-
as.matrix
(
agaricus.train
$
data
)
y
<-
agaricus.train
$
label
y
<-
agaricus.train
$
label
row.names
(
X
)
<-
paste
(
"rname"
,
seq
(
1L
,
nrow
(
X
))
,
sep
=
""
)
row.names
(
X
)
<-
paste
0
(
"rname"
,
seq
(
1L
,
nrow
(
X
)))
dtrain
<-
lgb.Dataset
(
X
,
label
=
y
,
params
=
list
(
max_bins
=
5L
))
dtrain
<-
lgb.Dataset
(
X
,
label
=
y
,
params
=
list
(
max_bins
=
5L
))
bst
<-
lgb.train
(
bst
<-
lgb.train
(
data
=
dtrain
data
=
dtrain
...
@@ -452,7 +452,7 @@ test_that("predict() keeps row names from data (multi-class classification)", {
...
@@ -452,7 +452,7 @@ test_that("predict() keeps row names from data (multi-class classification)", {
data
(
iris
)
data
(
iris
)
y
<-
as.numeric
(
iris
$
Species
)
-
1.0
y
<-
as.numeric
(
iris
$
Species
)
-
1.0
X
<-
as.matrix
(
iris
[,
names
(
iris
)
!=
"Species"
])
X
<-
as.matrix
(
iris
[,
names
(
iris
)
!=
"Species"
])
row.names
(
X
)
<-
paste
(
"rname"
,
seq
(
1L
,
nrow
(
X
))
,
sep
=
""
)
row.names
(
X
)
<-
paste
0
(
"rname"
,
seq
(
1L
,
nrow
(
X
)))
dtrain
<-
lgb.Dataset
(
X
,
label
=
y
,
params
=
list
(
max_bins
=
5L
))
dtrain
<-
lgb.Dataset
(
X
,
label
=
y
,
params
=
list
(
max_bins
=
5L
))
bst
<-
lgb.train
(
bst
<-
lgb.train
(
data
=
dtrain
data
=
dtrain
...
...
build_r.R
View file @
4b64b173
...
@@ -70,7 +70,7 @@ unrecognized_args <- setdiff(given_args, recognized_args)
...
@@ -70,7 +70,7 @@ unrecognized_args <- setdiff(given_args, recognized_args)
if
(
length
(
unrecognized_args
)
>
0L
)
{
if
(
length
(
unrecognized_args
)
>
0L
)
{
msg
<-
paste0
(
msg
<-
paste0
(
"Unrecognized arguments: "
"Unrecognized arguments: "
,
paste0
(
unrecognized_args
,
collapse
=
", "
)
,
toString
(
unrecognized_args
)
)
)
stop
(
msg
)
stop
(
msg
)
}
}
...
@@ -417,7 +417,7 @@ c_api_symbols <- gsub(
...
@@ -417,7 +417,7 @@ c_api_symbols <- gsub(
)
)
dynlib_statement
<-
paste0
(
dynlib_statement
<-
paste0
(
"useDynLib(lib_lightgbm, "
"useDynLib(lib_lightgbm, "
,
paste0
(
c_api_symbols
,
collapse
=
", "
)
,
toString
(
c_api_symbols
)
,
")"
,
")"
)
)
namespace_contents
[
dynlib_line
]
<-
dynlib_statement
namespace_contents
[
dynlib_line
]
<-
dynlib_statement
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment