Skip to content

Commit

Permalink
MAINT: Add rstcheck to CIs and pre-commit (mne-tools#12163)
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner authored Nov 2, 2023
1 parent fbc666d commit 89ec1d1
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,13 @@ repos:
hooks:
- id: yamllint
args: [--strict, -c, .yamllint.yml]

# rstcheck
- repo: https://github.com/rstcheck/rstcheck.git
rev: v6.2.0
hooks:
- id: rstcheck
files: ^doc/.*\.(rst|inc)$
# https://github.com/rstcheck/rstcheck/issues/199
# https://github.com/rstcheck/rstcheck/issues/200
exclude: ^doc/(help/faq|install/manual_install|install/mne_c|install/advanced|install/updating|_includes/channel_interpolation|_includes/inverse|_includes/ssp)\.rst$
1 change: 1 addition & 0 deletions doc/_includes/dig_formats.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
:orphan:

.. _dig-formats:

Supported formats for digitized 3D locations
Expand Down
2 changes: 2 additions & 0 deletions doc/development/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1111,3 +1111,5 @@ it can serve as a useful example of what to expect from the PR review process.
.. _optipng: http://optipng.sourceforge.net/
.. _optipng for Windows: http://prdownloads.sourceforge.net/optipng/optipng-0.7.7-win32.zip?download

.. include:: ../links.inc
2 changes: 2 additions & 0 deletions doc/documentation/design_philosophy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,5 @@ of data.
.. LINKS
.. _`method chaining`: https://en.wikipedia.org/wiki/Method_chaining

.. include:: ../links.inc
2 changes: 2 additions & 0 deletions doc/documentation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ Documentation for the related C and MATLAB tools are available here:
cookbook
cite
cited

.. include:: ../links.inc
2 changes: 2 additions & 0 deletions doc/install/mne_tools_suite.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,5 @@ Help with installation is available through the `MNE Forum`_. See the
.. _invertmeeg: https://github.com/LukeTheHecker/invert
.. _MNE-ARI: https://github.com/john-veillette/mne_ari
.. _niseq: https://github.com/john-veillette/niseq

.. include:: ../links.inc
6 changes: 5 additions & 1 deletion mne/decoding/tests/test_search_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# License: BSD-3-Clause

import platform
from inspect import signature

import numpy as np
Expand All @@ -10,7 +11,7 @@

from mne.decoding.search_light import GeneralizingEstimator, SlidingEstimator
from mne.decoding.transformer import Vectorizer
from mne.utils import _record_warnings, use_log_level
from mne.utils import _record_warnings, check_version, use_log_level

pytest.importorskip("sklearn")

Expand All @@ -29,6 +30,9 @@ def make_data():

def test_search_light():
"""Test SlidingEstimator."""
# https://github.com/scikit-learn/scikit-learn/issues/27711
if platform.system() == "Windows" and check_version("numpy", "2.0.0.dev0"):
pytest.skip("sklearn int_t / long long mismatch")
from sklearn.linear_model import LogisticRegression, Ridge
from sklearn.metrics import make_scorer, roc_auc_score
from sklearn.pipeline import make_pipeline
Expand Down
14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,17 @@ exclude = "(dist/)|(build/)|(.*\\.ipynb)"

[tool.bandit.assert_used]
skips = ["*/test_*.py"] # assert statements are good practice with pytest

[tool.rstcheck]
report_level = "WARNING"
ignore_roles = [
"func", "class", "term", "ref", "doc", "gh", "file", "samp", "meth", "mod", "kbd",
"newcontrib", "footcite", "footcite:t", "eq", "py:mod", "attr", "py:class", "exc",
]
ignore_directives = [
"rst-class", "tab-set", "grid", "toctree", "footbibliography", "autosummary",
"currentmodule", "automodule", "cssclass", "tabularcolumns", "minigallery",
"autoclass", "highlight", "dropdown", "graphviz", "glossary", "autofunction",
"bibliography",
]
ignore_messages = "^.*(Unknown target name|Undefined substitution referenced)[^`]*$"
2 changes: 1 addition & 1 deletion tools/azure_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ elif [ "${TEST_MODE}" == "pip-pre" ]; then
echo "misc"
python -m pip install $STD_ARGS imageio-ffmpeg xlrd mffpy python-picard pillow
echo "nibabel with workaround"
python -m pip install --progress-bar off git+https://github.com/mscheltienne/nibabel.git@np.sctypes
python -m pip install --progress-bar off git+https://github.com/nipy/nibabel.git
echo "joblib"
python -m pip install --progress-bar off git+https://github.com/joblib/joblib@master
echo "EDFlib-Python"
Expand Down
2 changes: 1 addition & 1 deletion tools/github_actions_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ else
echo "mne-qt-browser"
pip install $STD_ARGS git+https://github.com/mne-tools/mne-qt-browser
echo "nibabel with workaround"
pip install $STD_ARGS git+https://github.com/mscheltienne/nibabel.git@np.sctypes
pip install $STD_ARGS git+https://github.com/nipy/nibabel.git
echo "joblib"
pip install $STD_ARGS git+https://github.com/joblib/joblib@master
echo "EDFlib-Python"
Expand Down

0 comments on commit 89ec1d1

Please sign in to comment.