[GRASS-git] [OSGeo/grass] 5c3432: CI: Add Pylint check for selected files (#2198)

Vaclav Petras noreply at github.com
Tue Feb 15 11:05:29 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: 5c3432522ffa9a784a1e66decd3a9d95c1679645
      https://github.com/OSGeo/grass/commit/5c3432522ffa9a784a1e66decd3a9d95c1679645
  Author: Vaclav Petras <wenzeslaus at gmail.com>
  Date:   2022-02-15 (Tue, 15 Feb 2022)

  Changed paths:
    A .github/workflows/optional_requirements.txt
    A .github/workflows/pylint.yml
    M .github/workflows/pytest.yml
    M .github/workflows/python_requirements.txt
    A gui/wxpython/.pylintrc
    A python/.pylintrc
    M python/grass/jupyter/display.py
    M python/grass/jupyter/render3d.py

  Log Message:
  -----------
  CI: Add Pylint check for selected files (#2198)

This adds Pylint check job in a new workflow. It uses the current latest Pylint and latest Python. It uses Pylint to check for minimal supported Python version.

The check runs for the grass package (python/grass) and for wxGUI (gui/wxpython). However, most of the files are ignored. Each of the directories has its own .pylintrc file.

Pylint runs for grass.jupyter and grass.benchmark with only slightly modified configuration after fixes in targeted files (#2199, #2200, #2201, #2206). The approach for future compliance is that the other sub-packages should also eventually comply with default or almost default configuration.

For wxGUI, many Pylint messages are disabled and numbers driving coding standard limits, such as max number of local variables, are greatly loosened. Many of the disabled messages show real errors, but ignoring these for now allowed for enabling the check right away at least for the least problematic directories. The approach for future compliance is that new directories can be added (removed from ignore paths) and new issues can be checked (removed from disable) when fixed.

This compiles the code. Just testing Python functions from the grass package in the python directory does not require compiled code and package on path when started from the python directory, but checking other files requires packages on path.

The config file is in the python directory because that's the focus of this PR. (In the future, GUI may have a different config file, e.g., due to different naming conventions. On the other hand, in an ideal case, the whole source code will use this file or even a more strict version of this file in the future.)

Pylint should produce warning for disabled warnings which are not generated, although that seems to not be the case right now (useless-suppression).

The only code change here is that Pylint disable comment needs to be on the same line or inside ().

It needs to install also all optional Python dependencies because Pylint checks (can check unless disabled) all imports. This change is applied also to pytest workflow.

Using workflow on settings to run on push only to main and release branches and semver tags.

It uses strategy.matrix.include to get job-level config variables without using environmental variables.




More information about the grass-commit mailing list