Functions' list - arnthor89/pygame GitHub Wiki
Functions with high CC
Here's the list of all the complex (CC > 10) functions in the project.
================================================
NLOC CCN token PARAM length location
------------------------------------------------
110 63 3344 1 119 test_elementwise@1397-1515@./test/math_test.py
150 37 936 2 285 run@33-317@./test/test_utils/run_tests.py
96 36 685 1 120 process_chunk@1706-1825@./test/test_utils/png.py
92 33 2602 1 101 test_elementwise@474-574@./test/math_test.py
91 33 2097 1 100 test_elementwise@576-675@./test/math_test.py
83 29 487 3 192 from_array@1045-1236@./test/test_utils/png.py
112 27 1025 0 165 main@20-184@./examples/blit_blends.py
120 26 907 1 166 main@179-344@./examples/aliens.py
71 25 528 1 121 main@146-266@./buildconfig/config_unix.py
129 24 1225 1 158 test_blit_array@251-408@./test/surfarray_test.py
94 24 770 1 137 main@183-319@./examples/macosx/aliens_app_example/aliens.py
47 24 403 3 62 main@6-67@./examples/scaletest.py
50 24 370 4 59 writesetupfile@105-163@./buildconfig/config.py
92 23 543 3 130 draw@1025-1154@./src_py/sprite.py
75 23 558 0 99 main@47-145@./examples/textinput.py
63 23 461 0 68 main@227-294@./buildconfig/config_msys.py
60 22 463 1 64 test_array_keyword@222-285@./test/mixer_test.py
78 21 538 4 170 write_passes@623-792@./test/test_utils/png.py
36 20 214 5 67 SysFont@296-362@./src_py/sysfont.py
67 20 526 0 96 main@136-231@./examples/oldalien.py
68 19 482 0 83 main@16-98@./examples/blend_fill.py
50 19 331 1 56 main@165-220@./buildconfig/config.py
43 18 344 5 53 draw_polygon@525-577@./src_py/draw_py.py
21 18 357 1 32 test_draw_symetric_cross@731-762@./test/draw_test.py
85 18 525 1 143 output_main@93-235@./examples/midi.py
21 18 357 1 32 test_draw_symetric_cross@732-763@./build/lib.macosx-10.7-x86_64-3.7/pygame/tests/draw_test.py
43 18 340 4 53 draw_polygon@487-539@./build/lib.macosx-10.7-x86_64-3.7/pygame/draw_py.py
81 17 760 1 88 test_blit_blend@1944-2031@./test/surface_test.py
55 17 530 1 70 main@95-164@./examples/mask.py
68 17 521 1 88 main@101-188@./examples/scroll.py
33 17 263 2 33 choosepath@75-107@./buildconfig/config_win.py
66 16 569 3 120 load_xbm@244-363@./src_py/cursors.py
45 16 258 3 78 read_pnm_header@3383-3460@./test/test_utils/png.py
41 16 286 3 41 _get_buffer@158-198@./test/test_utils/buftools.py
39 16 417 2 57 load_xbm@244-300@./build/lib.macosx-10.7-x86_64-3.7/pygame/cursors.py
40 16 302 2 44 prepdep@60-103@./buildconfig/config.py
10 15 124 3 13 get_callables@188-200@./test/util/gen_stubs.py
33 14 217 6 73 tmap@238-310@./src_py/threads/__init__.py
44 14 284 0 74 initsysfonts_win32@66-139@./src_py/sysfont.py
50 14 334 2 157 test_suite@3184-3340@./test/test_utils/png.py
32 14 236 1 40 read_pam_header@3342-3381@./test/test_utils/png.py
118 14 841 1 139 _main@3525-3663@./test/test_utils/png.py
41 14 268 0 71 remove_old_files@643-713@./setup.py
34 13 253 6 52 clip_line@132-183@./src_py/draw_py.py
45 13 181 0 71 init@6-76@./src_py/camera.py
18 13 198 3 25 __call__@54-78@./test/test_utils/test_machinery.py
72 13 776 1 80 test_blit_blend_rgba@2033-2112@./test/surface_test.py
34 13 253 6 52 clip_line@132-183@./build/lib.macosx-10.7-x86_64-3.7/pygame/draw_py.py
39 13 215 1 45 main@539-583@./buildconfig/config_win.py
50 12 355 7 107 _draw_aaline@276-382@./src_py/draw_py.py
21 12 134 4 44 spritecollide@1483-1526@./src_py/sprite.py
22 12 163 3 45 __init__@1303-1347@./test/test_utils/png.py
34 12 282 2 52 combine_results@111-162@./test/test_utils/test_runner.py
43 12 499 1 51 test_array_to_surface_broadcasting@215-265@./test/pixelcopy_test.py
69 12 443 1 82 test_freetype_Font_use_bitmap_strikes@228-309@./test/freetype_test.py
46 12 394 0 58 main@62-119@./examples/eventlist.py
50 12 355 7 107 _draw_aaline@238-344@./build/lib.macosx-10.7-x86_64-3.7/pygame/draw_py.py
18 12 173 3 21 configure@91-111@./buildconfig/config_unix.py
54 11 318 7 88 _draw_line@186-273@./src_py/draw_py.py
30 11 191 4 51 compile@189-239@./src_py/cursors.py
30 11 197 0 48 warn_unwanted_files@202-249@./src_py/__init__.py
24 11 153 3 45 add@682-726@./src_py/sprite.py
21 11 129 1 27 check_palette@245-271@./test/test_utils/png.py
39 11 272 1 103 asDirect@1937-2039@./test/test_utils/png.py
57 11 426 1 63 test_surface_to_array_2d@81-143@./test/pixelcopy_test.py
65 11 476 1 71 test_surface_to_array_2d@344-414@./test/pixelcopy_test.py
37 11 265 1 46 main@87-132@./examples/playmus.py
30 11 200 6 50 _draw_line@186-235@./build/lib.macosx-10.7-x86_64-3.7/pygame/draw_py.py
30 11 191 4 51 compile@189-239@./build/lib.macosx-10.7-x86_64-3.7/pygame/cursors.py
38 11 289 7 38 __init__@47-84@./buildconfig/config_msys.py
56 11 443 1 68 main@128-195@./buildconfig/config_darwin.py
25 11 205 4 28 copytree@153-180@./buildconfig/download_win_prebuilt.py
27 11 192 0 27 parse_source_version@333-359@./setup.py
Interesting functions with sufficiently high CC
If we restrict our choice to functions that are meaningful for coverage improvement, we could list the function in src_py (so that we exclude /test /build /buildconfig and /example). Here's the resulting list.
================================================
NLOC CCN token PARAM length location
------------------------------------------------
92 23 543 3 130 draw@1025-1154@src_py/sprite.py
36 20 214 5 67 SysFont@296-362@src_py/sysfont.py
43 18 344 5 53 draw_polygon@525-577@src_py/draw_py.py
66 16 569 3 120 load_xbm@244-363@src_py/cursors.py
33 14 217 6 73 tmap@238-310@src_py/threads/__init__.py
44 14 284 0 74 initsysfonts_win32@66-139@src_py/sysfont.py
34 13 253 6 52 clip_line@132-183@src_py/draw_py.py
45 13 181 0 71 init@6-76@src_py/camera.py
50 12 355 7 107 _draw_aaline@276-382@src_py/draw_py.py
21 12 134 4 44 spritecollide@1483-1526@src_py/sprite.py
54 11 318 7 88 _draw_line@186-273@src_py/draw_py.py
30 11 191 4 51 compile@189-239@src_py/cursors.py
30 11 197 0 48 warn_unwanted_files@202-249@src_py/__init__.py
24 11 153 3 45 add@682-726@src_py/sprite.py
Chosen functions
Since we're 5, we should choose a subset of 10 function (2 for each member) to work on it performing the tasks of the project.
- Description (create a page on this wiki with answers to the questions written in the report)
- CC Calculation by hand for 5 function (the task is already done and the results are on this wiki)
- Coverage Measurement with our tool (push your implementation on branch issue7)
- Coverage Improvement writing 2 tests that regards some (preferably all) of the 10 functions
- Coverage Improvement Reloaded write other 2 tests that regards some of the 10 functions (P+ task)
- Design a refactoring plan for the 5 function (maybe this can be written in the same wiki page used for the description)
- Actuate a refactoring for 2 functions, so that their CC is reduced by 35% (P+ task) (!!! we still have to decide if the 2 function could belong to the usual 10 or should be in the top-10 most complex overall) Here's the list of the 10 functions:
- Alberto
54 11 318 7 88 _draw_line@186-273@src_py/draw_py.py
92 23 543 3 130 draw@1025-1154@src_py/sprite.py
- Martin
34 13 253 6 52 clip_line@132-183@src_py/draw_py.py
33 14 217 6 73 tmap@238-310@src_py/threads/__init__.py
- Thomas
66 16 569 3 120 load_xbm@244-363@src_py/cursors.py
30 11 191 4 51 compile@189-239@./src_py/cursors.py
- Therese
24 11 153 3 45 add@682-726@src_py/sprite.py
- Arnthor
36 20 214 5 67 SysFont@296-362@src_py/sysfont.py
22 10 117 3 33 match_font@379-411@src_py/sysfont.py