Complexity of the rst2pdf code

6 views
Skip to first unread message

Roberto Alsina

unread,
Nov 5, 2009, 9:58:58 AM11/5/09
to rst2pdf...@googlegroups.com
After the hard work Patrick is doing, the complexity of rst2pdf's code has
gone down a lot :-)

Here's the worse parts (and smartypants isn't ours ;-):

15 parseRaw
16 RstToPdf.__init__
16 validateCommands
17 RstToPdf.createPdf
19 code_block_directive
22 HandleTGroup.gather_elements
25 RstToPdf.filltable
27 main
32 loadFonts
37 PDFBuilder.assemble_doctree
45 smartyPants
108 StyleSheet.__init__

And, just for kicks, here's the worst part in 0.12.2:

15 parseRaw
16 RstToPdf.__init__
16 validateCommands
17 FancyPage.beforeDrawPage
17 RstToPdf.createPdf
19 code_block_directive
24 loadFonts
25 RstToPdf.filltable
26 main
37 PDFBuilder.assemble_doctree
45 smartyPants
65 RstToPdf.gen_pdftext
108 StyleSheet.__init__
190 RstToPdf.gen_elements

These numbers are done using pymetrics, and are the McCabe or Cyclomatic
complexity, which has a known correlation to defect frequency.

Of course automatic complexity measurements are to be taken with a grain of
salt, but this should point out what pieces of code are "hard" or at least
need looking at.


--
("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH)
(_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar
_..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia
(l)-'' ((i).' ((!.' according to alexa.com (27/5/2007)

Reply all
Reply to author
Forward
0 new messages