It seems like there is a major inconsistency in our Python linting infrastructure between these two categories of builds:
- source builds
- As per https://index.ros.org/doc/ros2/Installation/Crystal/Linux-Development-Setup/
- package-based builds
- as in build.ros2.org
- or for users installing from rosdep
In case 1, for source builds, we instruct to install Flake8 via
pip, and receive version 3.7
For case 2, for package-based builds, we install Flake8 via apt, and receive version 3.5
This is the first discrepancy - I ran into a hanging bug in flake8 3.5 in this PR, for valid Python syntax. The bug did not appear in either my local workspace or in the ci.ros2.org build, but did appear in the automated build.ros2.org PR build.
Next, the wiki instructions list a set of flake8 extensions to install.
python3 -m pip install -U \ argcomplete \ flake8 \ flake8-blind-except \ flake8-builtins \ flake8-class-newline \ flake8-comprehensions \ flake8-deprecated \ flake8-docstrings \ flake8-import-order \ flake8-quotes \ pytest-repeat \ pytest-rerunfailures \ pytest \ pytest-cov \ pytest-runner \ setuptools
Of the above extensions, only flake8-docstrings is present in the bionic apt repositories. So, PR builds do not enforce a subset of the linting requirements introduced by those extensions.
In conclusion, we have these problems today:
- A PR can pass automated linting, be merged, and break the CI nightly and packaging builds because it did not meet all the linter extension requirments
- A PR can break in automated PR build, but pass both locally and in CI builds.
(note that the above also applies to the pytest version, I see there is an open issue for that https://github.com/ros2/ci/issues/230)
How might we begin to address this? It’s a situation that we don’t want to stay in. Not even sure where issues might be opened, there are a few possibilities.