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
97ff7087
Unverified
Commit
97ff7087
authored
Aug 12, 2025
by
James Lamb
Committed by
GitHub
Aug 12, 2025
Browse files
[ci] use 'pre-commit' to run 'rstcheck' (#6989)
Co-authored-by:
Nikita Titov
<
nekit94-08@mail.ru
>
parent
ccc06d19
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
14 deletions
+22
-14
.ci/run-pre-commit-mypy.sh
.ci/run-pre-commit-mypy.sh
+0
-0
.ci/test.sh
.ci/test.sh
+1
-12
.pre-commit-config.yaml
.pre-commit-config.yaml
+9
-0
docs/env.yml
docs/env.yml
+2
-1
python-package/README.rst
python-package/README.rst
+1
-1
python-package/pyproject.toml
python-package/pyproject.toml
+9
-0
No files found.
.ci/
lint-python-bash
.sh
→
.ci/
run-pre-commit-mypy
.sh
View file @
97ff7087
File moved
.ci/test.sh
View file @
97ff7087
...
@@ -115,7 +115,7 @@ if [[ $TASK == "lint" ]]; then
...
@@ -115,7 +115,7 @@ if [[ $TASK == "lint" ]]; then
# shellcheck disable=SC1091
# shellcheck disable=SC1091
source
activate
"
${
CONDA_ENV
}
"
source
activate
"
${
CONDA_ENV
}
"
echo
"Linting Python and bash code"
echo
"Linting Python and bash code"
bash ./.ci/
lint-python-bash
.sh
||
exit
1
bash ./.ci/
run-pre-commit-mypy
.sh
||
exit
1
echo
"Linting R code"
echo
"Linting R code"
Rscript ./.ci/lint-r-code.R
"
${
BUILD_DIRECTORY
}
"
||
exit
1
Rscript ./.ci/lint-r-code.R
"
${
BUILD_DIRECTORY
}
"
||
exit
1
echo
"Linting C++ code"
echo
"Linting C++ code"
...
@@ -129,19 +129,8 @@ if [[ $TASK == "check-docs" ]] || [[ $TASK == "check-links" ]]; then
...
@@ -129,19 +129,8 @@ if [[ $TASK == "check-docs" ]] || [[ $TASK == "check-links" ]]; then
conda
env
create
\
conda
env
create
\
-n
"
${
CONDA_ENV
}
"
\
-n
"
${
CONDA_ENV
}
"
\
--file
./docs/env.yml
||
exit
1
--file
./docs/env.yml
||
exit
1
conda
install
\
-q
\
-y
\
-n
"
${
CONDA_ENV
}
"
\
'doxygen>=1.10.0'
\
'rstcheck>=6.2.4'
||
exit
1
# shellcheck disable=SC1091
# shellcheck disable=SC1091
source
activate
"
${
CONDA_ENV
}
"
source
activate
"
${
CONDA_ENV
}
"
# check reStructuredText formatting
find
"
${
BUILD_DIRECTORY
}
/python-package"
-type
f
-name
"*.rst"
\
-exec
rstcheck
--report-level
warning
{}
\+
||
exit
1
find
"
${
BUILD_DIRECTORY
}
/docs"
-type
f
-name
"*.rst"
\
-exec
rstcheck
--report-level
warning
--ignore-directives
=
autoclass,autofunction,autosummary,doxygenfile
{}
\+
||
exit
1
# build docs
# build docs
make
-C
docs html
||
exit
1
make
-C
docs html
||
exit
1
if
[[
$TASK
==
"check-links"
]]
;
then
if
[[
$TASK
==
"check-links"
]]
;
then
...
...
.pre-commit-config.yaml
View file @
97ff7087
...
@@ -27,6 +27,15 @@ repos:
...
@@ -27,6 +27,15 @@ repos:
hooks
:
hooks
:
-
id
:
yamllint
-
id
:
yamllint
args
:
[
"
--strict"
]
args
:
[
"
--strict"
]
-
repo
:
https://github.com/rstcheck/rstcheck
rev
:
v6.2.5
hooks
:
-
id
:
rstcheck
args
:
[
"
--config"
,
"
./python-package/pyproject.toml"
]
additional_dependencies
:
-
breathe>=4.36.0
-
sphinx>=8.1.3
-
sphinx_rtd_theme>=3.0.1
-
repo
:
https://github.com/astral-sh/ruff-pre-commit
-
repo
:
https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
# Ruff version.
rev
:
v0.12.5
rev
:
v0.12.5
...
...
docs/env.yml
View file @
97ff7087
...
@@ -3,7 +3,8 @@ channels:
...
@@ -3,7 +3,8 @@ channels:
-
nodefaults
-
nodefaults
-
conda-forge
-
conda-forge
dependencies
:
dependencies
:
-
breathe>=4.35
-
breathe>=4.36
-
doxygen>=1.13.2
-
python=3.12
-
python=3.12
-
r-base>=4.3.3
-
r-base>=4.3.3
-
r-data.table=1.16.4
-
r-data.table=1.16.4
...
...
python-package/README.rst
View file @
97ff7087
...
@@ -346,7 +346,7 @@ To check that a contribution to the package matches its style expectations, run
...
@@ -346,7 +346,7 @@ To check that a contribution to the package matches its style expectations, run
.. code:: sh
.. code:: sh
bash .ci/
lint-python-bash
.sh
bash .ci/
run-pre-commit-mypy
.sh
To run the tests locally and compute test coverage, install the Python package using one of the options mentioned above.
To run the tests locally and compute test coverage, install the Python package using one of the options mentioned above.
Then run the following from the root of the repo.
Then run the following from the root of the repo.
...
...
python-package/pyproject.toml
View file @
97ff7087
...
@@ -91,6 +91,15 @@ disallow_untyped_defs = true
...
@@ -91,6 +91,15 @@ disallow_untyped_defs = true
exclude
=
'build/*|compile/*|docs/*|examples/*|external_libs/*|lightgbm-python/*|tests/*'
exclude
=
'build/*|compile/*|docs/*|examples/*|external_libs/*|lightgbm-python/*|tests/*'
ignore_missing_imports
=
true
ignore_missing_imports
=
true
[tool.rstcheck]
report_level
=
"WARNING"
ignore_directives
=
[
"autoclass"
,
"autofunction"
,
"autosummary"
,
"doxygenfile"
]
[tool.ruff]
[tool.ruff]
exclude
=
[
exclude
=
[
"build"
,
"build"
,
...
...
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