Ignore:
Timestamp:
08/29/09 04:42:03 (3 years ago)
Author:
james
Message:

Add diagnostic to parse all abstracts and report any broken ones

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/diagnostics.tcl

    r947 r1026  
    328328} 
    329329 
     330### bMotion_diagnostic_parsing 
     331# Try to build every abstract we can and make sure it parses ok 
     332# This is not run automatically! 
     333# This is run as an admin plugin, so it tries to output to the admin stuff 
     334proc bMotion_diagnostic_parsing { } { 
     335        bMotion_putadmin "Counting abstracts..." 
     336        set all_abstracts [bMotion_abstract_get_names] 
     337        set all_abstracts_size [llength $all_abstracts] 
     338        bMotion_putadmin "Found $all_abstracts_size abstracts" 
     339 
     340        set broken [list] 
     341        set errors 0 
     342        set count_abstract 0 
     343        set count_lines 0 
     344        set i 0 
     345 
     346        foreach abstract $all_abstracts { 
     347                incr i 
     348                if {[expr $i % 10] == 0} { 
     349                        bMotion_putadmin "Processing abstract $i: $abstract..." 
     350                } 
     351                set abstract_contents [bMotion_abstract_all $abstract] 
     352                bMotion_putloglev d * "Processing [llength $abstract_contents] items for abstract $abstract" 
     353                incr count_abstract 
     354                foreach content $abstract_contents { 
     355                        incr count_lines 
     356                        set line "" 
     357                        set fail "" 
     358                        catch { 
     359                                set line [bMotion_process_macros "" $content] 
     360                                set line [bMotionDoInterpolation $line "JamesOff" "moretext" "#diagnostics"] 
     361                                # bit of a hack! 
     362                                set line [bMotion_plugin_output_preprocess "#diagnostics" $line] 
     363                        }  
     364                        if {($line == "") || [regexp {%(?!(SETTING|ruser|r?bot|BOT|percent|channel))[^%2\| ]} $line matches moo]} { 
     365                                incr errors 
     366                                lappend broken "$abstract:$content\r\n  -> $line" 
     367                        } 
     368                } 
     369        } 
     370 
     371        bMotion_putadmin "Finished." 
     372        bMotion_putadmin "$errors errors found in $count_lines lines in $count_abstract abstracts." 
     373        foreach line $broken { 
     374                bMotion_putadmin $line 
     375        } 
     376} 
     377 
    330378### bMotion_diagnostic_auto <<<1 
    331379proc bMotion_diagnostic_auto { min hr a b c } { 
Note: See TracChangeset for help on using the changeset viewer.