Skip to content

Commit

Permalink
CI(deps): Update dependency pylint to v3 (OSGeo#3820)
Browse files Browse the repository at this point in the history
* Format pyproject.toml

* Checks: Add note on MIN_PYTHON_VERSION

* Configure Pyright type checker

* CQ: Create default pylint config in pyproject.toml

* CQ: Port root pylint config to pyproject.toml

* CI(pylint): Update versions in workflow

* CI: Run Pylint on all project with source-roots configuration and ignore-paths

* CI(pylint): Do not use star glob for wxGUI pylint call

* Clear pylint config and reset to defaults

Set GRASS-specific overrides and comment out defaults

* CQ: Enable pylint plugins

* Set pylint's output-format to colorized

* CQ: Set pylint source-roots and ignore-paths

CQ: Set pylint ignore-paths to ignore libgrass_interface_generator and OBJ.* folders, and ignore Makefiles

* Checks: Rename pylint rules that were renamed

* Checks: Adjust outdated inline pylint exclusions

* Checks: Change pylint folder ignores

Checks: Also ignore .pytest_cache folder for pylint

* Checks: Disable all failing pylint rules

* CI(pylint): Remove rcfile argument from pytest pylint call

CI(pylint): Comment out pylint ignore arguments from pytest pylint call

* CI(pylint): Do not change into subdirectory for grass and gui

* CI(pylint): Run pylint on other files before slower wxGUI

* CI(pylint): Only run pylint once for all code

* checks: Remove non-modified pylint config

* style: Change misplaced docstring to comment in pygrass/rpc/__init__.py

* grass.script: Ignore signature-differs pylint warning in array.py

* grass.imaging.images2gif: Fix Pylint using-constant-test

* grass.jupyter.utils: Fix pylint redefined-variable-type (R0204) of output variable

Pylint 3.2.6 error: R0204: Redefinition of output type from bytes to grass.script.utils.KeyValue (redefined-variable-type)

Adds typing to the function analyzed, and also to the return type of the gs.parse_key_val() used.

* grass.script.db: Close opened file in db_connection

* t.unregister: Open file with context handler (SIM115)

* Typing improvement

* Fix typo of BufferedMapWindow in gui/wxpython/mapdisp/test_mapdisp.py

* pylint: Add pylint skip-file directive in generated file wxpython/menustrings.py
pylint: Ignore generated file wxpython/menustrings.py

* utils: Add timeout to requests.get

* grass.script.core: Fix E0606: Possibly using variable 'ps' before assignment (possibly-used-before-assignment)

Co-authored-by: Edouard Choinière <[email protected]>
  • Loading branch information
renovate[bot] and echoix authored Dec 27, 2024
1 parent 54188d7 commit 5e0dc97
Show file tree
Hide file tree
Showing 22 changed files with 426 additions and 2,330 deletions.
44 changes: 23 additions & 21 deletions .github/workflows/python-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:

env:
# renovate: datasource=python-version depName=python
PYTHON_VERSION: "3.10"
MIN_PYTHON_VERSION: "3.8"
PYTHON_VERSION: "3.12"
MIN_PYTHON_VERSION: "3.9"
# renovate: datasource=pypi depName=black
BLACK_VERSION: "24.10.0"
# renovate: datasource=pypi depName=flake8
FLAKE8_VERSION: "7.1.1"
# renovate: datasource=pypi depName=pylint
PYLINT_VERSION: "2.12.2"
PYLINT_VERSION: "3.3.2"
# renovate: datasource=pypi depName=bandit
BANDIT_VERSION: "1.8.0"
# renovate: datasource=pypi depName=ruff
Expand Down Expand Up @@ -156,37 +156,39 @@ jobs:
echo "$HOME/install/bin" >> $GITHUB_PATH
- name: Run Pylint on grass package
# Until slower checks (like similarity) are reenabled, running in one step is faster
if: false
run: |
export PYTHONPATH=`grass --config python_path`:$PYTHONPATH
export LD_LIBRARY_PATH=$(grass --config path)/lib:$LD_LIBRARY_PATH
cd python
pylint --persistent=no --py-version=${{ env.MIN_PYTHON_VERSION }} --jobs=$(nproc) grass
- name: Run Pylint on other files using pytest
# Until slower checks (like similarity) are reenabled, running in one step is faster
if: false
run: |
pipx inject --include-apps pylint pytest
pipx inject pylint pytest-pylint pytest-github-actions-annotate-failures pytest-timeout
export PYTHONPATH=`grass --config python_path`:$PYTHONPATH
export LD_LIBRARY_PATH=$(grass --config path)/lib:$LD_LIBRARY_PATH
pytest --pylint -m pylint --pylint-jobs=$(nproc) \
--pylint-ignore-patterns="${{ env.PylintIgnore }}"
env:
PylintIgnore: "python/.*,gui/.*"

- name: Run Pylint on wxGUI
# Until slower checks (like similarity) are reenabled, running in one step is faster
if: false
run: |
export PYTHONPATH=`grass --config python_path`:$PYTHONPATH
export LD_LIBRARY_PATH=$(grass --config path)/lib:$LD_LIBRARY_PATH
cd gui/wxpython
pylint --persistent=no --py-version=${{ env.MIN_PYTHON_VERSION }} --jobs=$(nproc) *
pylint --persistent=no --py-version=${{ env.MIN_PYTHON_VERSION }} --jobs=$(nproc) gui
- name: Run Pylint on other files using pytest
- name: Run Pylint all in one pass
run: |
pipx inject --include-apps pylint pytest==7.4.4
pipx inject pylint pytest-pylint==0.19 pytest-github-actions-annotate-failures
echo "::warning file=.github/workflows/python-code-quality.yml,line=149,col=42,endColumn=48::\
Temporarily downgraded pytest-pylint and pytest to allow merging other PRs.\
The errors reported with a newer version seem legitimite and should be fixed \
(2023-10-18, see https://github.com/OSGeo/grass/pull/3205)\
(2024-01-28, see https://github.com/OSGeo/grass/issues/3380)"
export PYTHONPATH=`grass --config python_path`:$PYTHONPATH
export LD_LIBRARY_PATH=$(grass --config path)/lib:$LD_LIBRARY_PATH
pytest --pylint -m pylint --pylint-rcfile=.pylintrc --pylint-jobs=$(nproc) \
--pylint-ignore-patterns="${{ env.PylintIgnore }}"
env:
PylintIgnore: "python/.*,gui/wxpython/.*,doc/.*,man/.*,utils/.*,locale/.*,raster/.*,\
imagery/.*,scripts/r.in.wms/wms_drv.py,scripts/g.extension/g.extension.py,\
temporal/t.rast.accdetect/t.rast.accdetect.py,temporal/t.rast.accumulate/t.rast.accumulate.py,\
scripts/d.rast.edit/d.rast.edit.py"
pylint --persistent=no --py-version=${{ env.MIN_PYTHON_VERSION }} --jobs=$(nproc) .
- name: Test compiling example modules
run: |
Expand Down
Loading

0 comments on commit 5e0dc97

Please sign in to comment.