Break up the huge function by extracting a class, storing intermediate
state as class members and breaking up the big function into a group
of class methods all at the same level of abstraction.
Details
Diff Detail
Event Timeline
I really want to get these reviewed quickly. Otherwise, I will run out of available time to complete them and get them submitted.
I will give my best to be available this weekend but the review takes time until the patch is in an acceptable state, same for the other revision.
This process is required to keep good quality and catch bugs, even subtile ones early. Breaking code is the worst of all options.
test/clang-tidy/check_clang_tidy.py | ||
---|---|---|
103 ↗ | (On Diff #180349) | Such a long list of returned values make me wonder if it would be worth creating a NamedTuple / class to hold them. |
141 ↗ | (On Diff #180349) | These three check_* function all use the same 'FileCheck', '-....'] pattern. Maybe it's worth syndicating that to a try_run_filecheck(input_file0, input_file1, *extra_args)` function. |
178 ↗ | (On Diff #180349) | This is the verbose call site I was pointing to above. |
To avoid passing lots of state to/from extracted functions, extract a class instead and use member variables for most of the state
From my side its LGTM, but I would let @serge-sans-paille accept, as he is probably more familiar with python then I am.
test/clang-tidy/check_clang_tidy.py | ||
---|---|---|
112 ↗ | (On Diff #180349) | That can be done in a later commit; it is not the point of this review. |
141 ↗ | (On Diff #180349) | That can be done in a later commit; it is not the point of this review. |
178 ↗ | (On Diff #180349) | Addressed by Extract Class instead of Extract Function |
206 ↗ | (On Diff #180349) | It's the wrong level of abstraction for the if check to be inside run() |
This was accepted before in August, 2019, but the script changed in the meantime. I've repeated the Extract Class on top-of-tree,
so presumably this is still acceptable. However, I don't know how commit access has changed. (I don't think I have it anymore.)
If there are no new comments by the end of the week, I'm going to accept this revision and commit it.
Resigning only because I don't think I have strong enough Python skills to give a quality review. I didn't spot anything that concerned me specific to this patch though.