There are cases where the generated __init__.py file may fail the import order, triggering I100 flake8 warnings. For example, if you have these services:
PCVTargMaxCommand.srv
PCWindCurrCommand.srv
The generated file has them ordered like this:
from buoy_msgs.srv._pcv_targ_max_command import PCVTargMaxCommand # noqa: F401
from buoy_msgs.srv._pc_wind_curr_command import PCWindCurrCommand # noqa: F401
Which doesn't satisfy flake8-import-order.
Expected behavior
Generated files don't give warnings.
Actual behavior
There are corner cases where warnings are triggered.
Additional information
I believe this happens because the sorting order for the module names changes after the call to convert_camel_case_to_lower_case_underscore here:
Bug report
Required Info:
Steps to reproduce issue
There are cases where the generated
__init__.py
file may fail the import order, triggeringI100
flake8 warnings. For example, if you have these services:The generated file has them ordered like this:
Which doesn't satisfy
flake8-import-order
.Expected behavior
Generated files don't give warnings.
Actual behavior
There are corner cases where warnings are triggered.
Additional information
I believe this happens because the sorting order for the module names changes after the call to
convert_camel_case_to_lower_case_underscore
here:https://github.com/ros2/rosidl_python/blob/619e43fab77081d0d35664d514fbe9c1e679a56c/rosidl_generator_py/rosidl_generator_py/generate_py_impl.py#L124-L129
One solution could be to copy the converted names to another variable and sort that with the final names before writing to the file.
Another possible solution is to just suppress that warning for every generated line, i.e.