-
Notifications
You must be signed in to change notification settings - Fork 936
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
Remove superfluous type check to reduce complexity #1510
Conversation
I'm not sure why the action for Python3.8 pytest on MacOS is flaky, so I re-ran it. It runs fine for me locally
|
I have the same problem, locally it runs fine. I a. slowly identifying the problem, but until then doing reruns. |
40780fd
to
a25de7f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please reinsert the slaves check, otherwise this is ready to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That arguments I cannot counter ! I suppose I know parts of the code better, but that means I often fall into "we normally do" so it is very good, that you question things.
ruff
,pylint
, andradon
all report a McCabe complexity of 11 for this function:pymodbus/pymodbus/server/async_io.py
Line 166 in 759b222
There's a conditional to cast
slaves
to a list if it's an integer:pymodbus/pymodbus/server/async_io.py
Lines 204 to 205 in 759b222
However, I think this isn't needed since
slaves
will be setup as a list.pymodbus/pymodbus/datastore/context.py
Lines 196 to 199 in 759b222
Killing this conditional reduces the McCabe complexity from 11 to 10 for both
ruff
andradon
, althoughpylint
still reports it as 11 for some reason >_>. (I've therefore kept the# pylint: disable=too-complex
for now. In the future I intend to disable in favor of ruff.)