Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] update some linting versions #6598

Merged
merged 4 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ fi
if [[ $TASK == "lint" ]]; then
mamba create -q -y -n $CONDA_ENV \
${CONDA_PYTHON_REQUIREMENT} \
'cmakelint>=1.4.2' \
'cmakelint>=1.4.3' \
'cpplint>=1.6.0' \
'matplotlib-base>=3.8.3' \
'mypy>=1.8.0' \
'pre-commit>=3.6.0' \
'pyarrow>=6.0' \
'matplotlib-base>=3.9.1' \
'mypy>=1.11.1' \
'pre-commit>=3.8.0' \
'pyarrow-core>=17.0' \
'r-lintr>=3.1.2'
source activate $CONDA_ENV
echo "Linting Python code"
Expand All @@ -124,7 +124,7 @@ if [[ $TASK == "check-docs" ]] || [[ $TASK == "check-links" ]]; then
-y \
-n $CONDA_ENV \
'doxygen>=1.10.0' \
'rstcheck>=6.2.0' || exit 1
'rstcheck>=6.2.4' || exit 1
source activate $CONDA_ENV
# check reStructuredText formatting
cd "${BUILD_DIRECTORY}/python-package"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ concurrency:

env:
COMPILER: 'gcc'
MAKEFLAGS: '-j4'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While looking at this configuration, I realized that the check-r-docs job is installing a bunch of R packages on Linux. CRAN doesn't provide Linux binaries, so that means they're all being compiled from source.

Parallelizing compilation should speed that job up, as we do with the other R jobs:

OS_NAME: 'linux'
PYTHON_VERSION: '3.12'

jobs:
test:
name: ${{ matrix.task }}
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will prevent needing to update this OS version in the future. I don't think there's any reason this job needs to be on 22.04 specifically.

timeout-minutes: 60
strategy:
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
args: ["--settings-path", "python-package/pyproject.toml"]
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.4.7
rev: v0.5.7
hooks:
# Run the linter.
- id: ruff
Expand Down
2 changes: 1 addition & 1 deletion tests/python_package_test/test_sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _create_data(task, n_samples=100, n_features=4):
elif task == "multiclass-classification":
centers = 3
else:
ValueError(f"Unknown classification task '{task}'")
raise ValueError(f"Unknown classification task '{task}'")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From ruff:

tests/python_package_test/test_sklearn.py:56:13: PLW0133 Missing `raise` statement on exception
   |
54 |             centers = 3
55 |         else:
56 |             ValueError(f"Unknown classification task '{task}'")
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW0133
57 |         X, y = make_blobs(n_samples=n_samples, n_features=n_features, centers=centers, random_state=42)
58 |         g = None
   |
   = help: Add `raise` keyword

Found 1 error.

X, y = make_blobs(n_samples=n_samples, n_features=n_features, centers=centers, random_state=42)
g = None
elif task == "regression":
Expand Down
Loading