BEGIN{ twikibitCount = 0; moduleCount = 0; funcCallCount = 0; nnoexcuse = 0; noexcuse["TWiki::getGmDate"] = -1; noexcuse["TWiki::initialize"] = -1; noexcuse["TWiki::webNameRegex"] = -1; noexcuse["TWiki::mainTopicname"] = -1; noexcuse["TWiki::Store::_readTemplateFile"] = -1; noexcuse["TWiki::Store::saveTopic"] = 10; noexcuse["TWiki::Store::lockTopic"] = 10; noexcuse["TWiki::getPubDir"] = 10; noexcuse["TWiki::superAdminGroup"] = -1; noexcuse["TWiki::handleEnvVariable"] = -1; noexcuse["TWiki::Store::getRevisionNumberX"] = -1; noexcuse["TWiki::isoMonth"] = -1; noexcuse["TWiki::doSecureInclude"] = -1; noexcuse["TWiki::Store::readTopicRaw"] = 10; noexcuse["TWiki::useLocale"] = -1; noexcuse["TWiki::upperAlpha"] = -1; noexcuse["TWiki::mixedAlphaNum"] = -1; noexcuse["TWiki::twikiWebname"] = -1; noexcuse["TWiki::getEmailOfUser"] = -1; noexcuse["TWiki::getEmailNotifyList"] = -1; noexcuse["TWiki::Prefs::getPreferencesFlag"] = 10; noexcuse["TWiki::rcsDir"] = -1; noexcuse["TWiki::rcsArgs"] = -1; noexcuse["TWiki::urlHost"] = 10; noexcuse["TWiki::Func"] = -1; noexcuse["TWiki::fgrepCmd"] = -1; noexcuse["TWiki::emitList"] = 10; noexcuse["TWiki::Store::getWebTopic"] = 10; noexcuse["TWiki::Store::getRevisionInfoFromMeta"] = 10; noexcuse["TWiki::wikiUserName"] = 10; noexcuse["TWiki::getSkin"] = 10; noexcuse["TWiki::Store::initialize"] = -1; noexcuse["TWiki::Access::initializeAccess"] = -1; noexcuse["TWiki::Prefs::initializePrefs"] = -1; noexcuse["TWiki::notifyTopicname"] = -1; noexcuse["TWiki::defaultUserName"] = -1; noexcuse["TWiki::Store::getAllWebs"] = 10; noexcuse["TWiki::Attach::renderMetaData"] = 10; noexcuse["TWiki::noSpamPadding"] = -1; noexcuse["TWiki::newTopicBgColor"] = -1; noexcuse["TWiki::Form::getFieldParams"] = 10; noexcuse["TWiki::Store::getRevisionDiff"] = 10; noexcuse["TWiki::getTWikiLibDir"] = -1; noexcuse["TWiki::Store::templateVars"] = -1; noexcuse["TWiki::Store::handleTmplP"] = -1; noexcuse["TWiki::Net::getUrl"] = -1; noexcuse["TWiki::getRenderedVersion"] = 10; noexcuse["TWiki::handleIncludeUrl"] = 10; noexcuse["TWiki::Store::getRevisionNumber"] = 10; noexcuse["TWiki::Access::checkAccessPermission"] = 10; noexcuse["TWiki::wikiToUserList"] = 10; noexcuse["TWiki::Plugins"] = -1; noexcuse["TWiki::egrepCmd"] = 10; noexcuse["TWiki::Search::searchWeb"] = 10; noexcuse["TWiki::Store::readTopMeta"] = 10; noexcuse["TWiki::TranslationToken"] = -1; noexcuse["TWiki::logDir"] = -1; noexcuse["TWiki::Notifications::"] = 10; noexcuse["TWiki::wikiWordRegex"] = -1; noexcuse["TWiki::Store::webExists"] = 10; noexcuse["TWiki::topicName"] = 10; noexcuse["TWiki::wikiToUserName"] = 10; noexcuse["TWiki::securityFilter"] = -1; noexcuse["TWiki::writeDebug"] = 10; noexcuse["TWiki::Store::saveFile"] = 10; noexcuse["TWiki::handleCommonTags"] = 10; noexcuse["TWiki::getScriptUrl"] = 10; noexcuse["TWiki::defaultUrlHost"] = 10; noexcuse["TWiki::Store::getTopicNames"] = 10; noexcuse["TWiki::Prefs::handlePreferencesTags"] = 10; noexcuse["TWiki::Prefs::getPropertyValue"] = 10; noexcuse["TWiki::Net::sendEmail"] = -1; noexcuse["TWiki::mainWebname"] = 10; noexcuse["TWiki::Store::readFile"] = 10; noexcuse["TWiki::formatGmTime"] = -1; noexcuse["TWiki::cmdQuote"] = -1; noexcuse["TWiki::scriptUrlPath"] = 10; noexcuse["TWiki::Store::readWebTopic"] = 10; noexcuse["TWiki::pubUrlPath"] = 10; noexcuse["TWiki::Store::readTemplate"] = -1; noexcuse["TWiki::handleIncludeFile"] = 10; noexcuse["TWiki::userToWikiName"] = 10; noexcuse["TWiki::webName"] = 10; noexcuse["TWiki::Store::topicExists"] = 10; noexcuse["TWiki::Store::readTopic"] = 10; noexcuse["TWiki::dataDir"] = 10; noexcuse["TWiki::cgiQuery"] = 10; noexcuse["TWiki::extractNameValuePair"] = 10; noexcuse["TWiki::Prefs::getPreferencesValue"] = 10; getCall("getSessionValue"); getCall("setSessionValue"); getCall("getSkin"); getCall("getUrlHost"); getCall("getScriptUrl"); getCall("getScriptUrlPath"); getCall("getViewUrl"); getCall("getOopsUrl"); getCall("getPubUrlPath"); getCall("getCgiQuery"); getCall("writeHeader"); getCall("redirectCgiQuery"); getCall("extractNameValuePair"); getCall("getPreferencesValue"); getCall("getPreferencesFlag"); getCall("getWikiToolName"); getCall("getMainWebname"); getCall("getTwikiWebname"); getCall("getDefaultUserName"); getCall("getWikiName"); getCall("getWikiUserName"); getCall("wikiToUserName"); getCall("userToWikiName"); getCall("isGuest"); getCall("permissionsSet"); getCall("checkAccessPermission"); getCall("webExists"); getCall("topicExists"); getCall("getRevisionInfo"); getCall("checkTopicEditLock"); getCall("setTopicEditLock"); getCall("readTopicText"); getCall("saveTopicText"); getCall("getPublicWebList"); getCall("getTopicList"); getCall("expandCommonVariables"); getCall("renderText"); getCall("internalLink"); getCall("formatGmTime"); getCall("getDataDir"); getCall("getPubDir"); getCall("readTopic"); getCall("readTemplate"); getCall("readFile"); getCall("saveFile"); getCall("writeWarning"); getCall("writeDebug"); } function getCall(f) { if (funcCallIndex[f] == 0) { funcCallName[++funcCallCount] = f; funcCallIndex[f] = funcCallCount; } return funcCallIndex[f]; } /^GOOD .*$/ { funcCall = getCall($3); goodCalls[funcCall] += $4; if ($4 > 0 && index(callers[funcCall], "Plugins." $2 " ") == 0) { callers[funcCall] = callers[funcCall] " Plugins." $2 " "; } } /^SCRIPT.*$/ { scripts[$2] = scripts[$2] " " $3; } /^BAD .*$/{ module = $2; twikibit = $3; if (moduleIndex[module] == 0) { moduleName[++moduleCount] = module; moduleIndex[module] = moduleCount; } pi = moduleIndex[module]; if (twikibitIndex[twikibit] == 0) { twikibitName[++twikibitCount] = twikibit; twikibitIndex[twikibit] = twikibitCount; } fi = twikibitIndex[twikibit]; funcu[fi]++; if (index(badCalls[fi], module) == 0) { badCalls[fi] = badCalls[fi] " Plugins." module; } baddie[pi]++; baddies[pi] += noexcuse[twikibit]; } END{ print "TWiki::Func function calls"; sort(goodCalls, funcCallCount, funcCallName, callers); print ""; max = goodCalls[funcCallCount]; for (i = funcCallCount; i > 0; i--) { col = 255 * i / funcCallCount; print tr(max-goodCalls[i], max, td(funcCallName[i]) td(goodCalls[i]) td(callers[i])); } print "
FunctionUsesCallers
"; print ""; print "Abuses of functions and variables not published by TWiki::Func" print ""; sort(funcu, twikibitCount, twikibitName, badCalls); for (i = 1; i <= twikibitCount; i++) { print tr(funcu[i], funcu[twikibitCount], td(twikibitName[i]) td(funcu[i]) td(badCalls[i])); } print "
TokenNumber of usesAbusers
"; print "Most abusive module"; print ""; sort(baddie, moduleCount, moduleName); for (i = 1; i <= moduleCount; i++) { howbad = baddie[i] / baddie[moduleCount] * 1000; print tr(baddie[i], baddie[moduleCount], td(" Plugins." moduleName[i] " ") td(howbad)); } print "
NameBadness
"; } function tohex(i) { s = ""; digits = "0123456789ABCDEF"; for (j = 0; j < 2; j++) { s = substr(digits, i % 16 + 1, 1) s; i = i / 16; } return s; } function swap(a, n, n1, t) { t = a[n]; a[n] = a[n1]; a[n1] = t; } function sort(a, n, b, c, i, done) { done = 1; while (done > 0) { done = 0; for (i = 1; i < n; i++) { if (a[i] > a[i+1]) { swap(a, i, i + 1); swap(b,i,i+1); swap(c,i,i+1); done++; } } } } function td(s) { return "" s ""; } function tr(i, fc, td, col) { col = 255 * i / fc; return "" td ""; }