-
Notifications
You must be signed in to change notification settings - Fork 170
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
Use setup.cfg to configure flake8, instead of in the ci code #930
Use setup.cfg to configure flake8, instead of in the ci code #930
Conversation
This makes flake8's configuration more discoverable and easier to use with other tools (IDE, etc.). Regression: it seems that "max-complexity" wasn't properly enforced, now a lot of code is detected as too complex. (warn if > 10, max is 25) We may need to adjust the value.
@cottsay What do you say? There are dozens of functions flagged as "too complex"(C901). I suggest changing |
We might as well revert #912 if this fixes those problems on macos. It might be related to complexity not being properly checked, due to using the old API. |
Inline comments are not allowed in flake8>=6.0
Because it doesn't have a stable public API.
Just FYI, bumping
Personally, I think both are valid and should be fixed in a separate PR. |
If we're not enforcing the rule right now, the first move is to set a backstop at a higher level and get it merged before things get worse. We can clean up the complexity and reduce the limit in a future change. |
@cottsay by backstop, do you mean changing the complexity in this pr from 10 to around (whatever smallest that works)? |
Yes |
@cottsay Done, it's ready to be merged! |
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.
Thanks for tackling this. Only major concern is that we'd like to continue to support Python 2 until the next release.
Out of curiosity, why wasn't max_complexity
enforced before? Underscore vs hyphen?
Co-authored-by: Scott K Logan <logans@cottsay.net>
Looks like the legacy API accepted |
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.
This is a deviation from how we've been doing flake8 tests in the rest of ROS, but the upstream churn has been breaking us constantly and I don't see any reason not to take this route everywhere else, too.
That said, I'd like to hear from other ros-infrastructure
maintainers if they see any drawbacks with the process invocation approach taken here.
I tested locally with both passing and non-passing result and in both cases the flake8 output was properly set. This might even make it easier for me to add some local overrides (i.e. I have a |
This makes flake8's configuration more discoverable and easier to use with other tools (IDE, etc.).
Regression: it seems that "max-complexity" wasn't properly enforced, now a lot of code is detected as too complex. (warn if > 10, max is 25)We may need to adjust the value.
Complexity adjusted to 26 to satisfy the current code's needs.