Added support of match pattern
Added support of match pattern introduced in python 3.10. @rubik comments/proposals are welcomed.
This is a very welcome and also a very much needed addition to radon. @DolajoCZ, thank you for this PR.
I would like to know whether case _: is treated the same way as else: is, i.e., it should not add complexity. Is that the case here? It wasn't obvious to me in this PR's code that I've read.
Yes, case _: is covered by this line. You can try it with following code.
def match_test_with_else() -> None:
"""Match test - with _ (else) case."""
a = 0
match a:
case 1:
pass
case 2:
pass
case _:
pass
def match_test_without_else() -> None:
"""Match test - without _ (else) case."""
a = 0
match a:
case 1:
pass
case 2:
pass
For both functions you get rating A(3)
Why is this still an open PR and not a merged one? Also, why is radon so slow at releasing a new version?
@rubik, are you still alive?
@DolajoCZ Thanks for the contribution, much appreciated. It would be great if you could document this addition in the table on this page: https://github.com/rubik/radon/blob/master/docs/intro.rst
The PR is otherwise ready for merging.
@PedanticHacker I am indeed alive, I'm just very busy. If you want to help maintain the project let me know.
@rubik, it would actually be an honor for me to contribute to this project. I'm using radon quite often to test cyclomatic complexity in my chess GUI app named SuperChess, so I'd like to give back to the community.
@rubik doc was updated. Thank you for notice.
Can you please also check status of this this PR. Thanks
Any updates on this PR? I just found radon - what an awesome tool. It would be great if this PR was merged and a new release was issued to fully support python 10!
Do we have an update on this one? Without it cyclomatic complexity is still wrongly detected as O(1) for match .
@rubik
This is batshit crazy to abandon a project like radon. It’s a very good tool.
@DolajoCZ Thanks for the contribution, I finally got around to take a look again and merge it. Apologies everyone for the lack of maintenance, I've been very busy with personal and work commitments.