(NFC) .toxic.json - Update list of functions which yield toxic warnings
authorTim Otten <totten@civicrm.org>
Mon, 20 Nov 2017 22:21:53 +0000 (14:21 -0800)
committerTim Otten <totten@civicrm.org>
Mon, 20 Nov 2017 22:21:53 +0000 (14:21 -0800)
The file `.toxic.json` is supposed to list egregious functions -- any change
to these functions should produce extra comments/suggestsions.

The current list is a few years old, so I've run `pdepend` and updated the list.
The list includes anything which matches one or more of these:

 * "Non Comment Lines of Code" (`ncloc`) greater than 300.
 * "[NPath](https://modess.io/npath-complexity-cyclomatic-complexity-explained/) complexity" (`npath`) greater than 1 billion.

.toxic.json

index 5d1f2a3d854bb300cd7cf6001d76ae35cbd38251..d24776f28356de0bf930d348d33f963c7eb5d8b2 100644 (file)
@@ -3,16 +3,79 @@
     "toxicAlert": "<img alt=\"Please: Help save the fish from toxic code\" src=\"https://civicrm.org/sites/civicrm.org/files/HazCode-Please.png\">\n\n(Automated notice) This pull-request modifies {SYMBOLS}. That code has been previously identified as hazardous. For advice on dealing with it, please review [Toxic Code Protocol](http://wiki.civicrm.org/confluence/display/CRM/Toxic+Code+Protocol)."
   },
   "checks": {
-    "CRM_Contact_Import_Parser_Contact::import()": "toxicAlert",
-    "CRM_Core_BAO_Mapping::buildMappingForm()": "toxicAlert",
-    "CRM_Event_Form_Participant::postProcess()": "toxicAlert",
-    "CRM_Export_BAO_Export::exportComponents()": "toxicAlert",
-    "CRM_Member_Form_Membership::postProcess()": "toxicAlert",
-    "CRM_Contribute_Form_Contribution::postProcess()": "toxicAlert",
+    "CRM_Activity_BAO_Activity::create()": "toxicAlert",
+    "CRM_Activity_Form_Activity::preProcess()": "toxicAlert",
+    "CRM_Case_BAO_Case::getCaseActivity()": "toxicAlert",
+    "CRM_Case_BAO_Case::mergeCases()": "toxicAlert",
+    "CRM_Contact_BAO_Contact::formatProfileContactParams()": "toxicAlert",
+    "CRM_Contact_BAO_ContactTest::testCreateProfileContact()": "toxicAlert",
+    "CRM_Contact_BAO_Individual::format()": "toxicAlert",
+    "CRM_Contact_BAO_Query::addHierarchicalElements()": "toxicAlert",
+    "CRM_Contact_BAO_Relationship::relatedMemberships()": "toxicAlert",
+    "CRM_Contact_Form_Contact::postProcess()": "toxicAlert",
     "CRM_Contact_Import_Form_MapField::buildQuickForm()": "toxicAlert",
+    "CRM_Contact_Import_Parser::formatCommonData()": "toxicAlert",
+    "CRM_Contact_Import_Parser::formatContactParameters()": "toxicAlert",
+    "CRM_Contact_Import_Parser::run()": "toxicAlert",
+    "CRM_Contact_Import_Parser_Contact::import()": "toxicAlert",
+    "CRM_Contribute_BAO_Contribution::recordFinancialAccounts()": "toxicAlert",
+    "CRM_Contribute_BAO_Contribution::transitionComponents()": "toxicAlert",
+    "CRM_Contribute_BAO_ContributionPage::sendMail()": "toxicAlert",
+    "CRM_Contribute_BAO_Query::whereClauseSingle()": "toxicAlert",
+    "CRM_Contribute_Form_Contribution::buildQuickForm()": "toxicAlert",
+    "CRM_Contribute_Form_Contribution::submit()": "toxicAlert",
+    "CRM_Contribute_Form_ContributionBase::preProcess()": "toxicAlert",
+    "CRM_Contribute_Form_ContributionPage_Amount::postProcess()": "toxicAlert",
+    "CRM_Contribute_Form_Contribution_Confirm::postProcessMembership()": "toxicAlert",
+    "CRM_Contribute_Form_Contribution_Confirm::processFormSubmission()": "toxicAlert",
+    "CRM_Contribute_Form_Contribution_Main::buildQuickForm()": "toxicAlert",
     "CRM_Contribute_Form_Contribution_Main::formRule()": "toxicAlert",
+    "CRM_Contribute_Form_Contribution_Main::submit()": "toxicAlert",
+    "CRM_Contribute_Form_Task_Invoice::printPDF()": "toxicAlert",
+    "CRM_Contribute_Import_Parser::run()": "toxicAlert",
+    "CRM_Core_BAO_ActionScheduleTest::setUp()": "toxicAlert",
+    "CRM_Core_BAO_CustomField::formatCustomField()": "toxicAlert",
+    "CRM_Core_BAO_CustomGroup::getTree()": "toxicAlert",
+    "CRM_Core_BAO_Mapping::buildMappingForm()": "toxicAlert",
+    "CRM_Core_BAO_UFGroup::buildProfile()": "toxicAlert",
+    "CRM_Core_BAO_UFGroup::getValues()": "toxicAlert",
+    "CRM_Core_I18n_SchemaStructure::widgets()": "toxicAlert",
+    "CRM_Core_Permission::getEntityActionPermissions()": "toxicAlert",
+    "CRM_Core_PseudoConstantTest::testOptionValues()": "toxicAlert",
+    "CRM_Custom_Form_Field::formRule()": "toxicAlert",
+    "CRM_Dedupe_Merger::getRowsElementsAndInfo()": "toxicAlert",
+    "CRM_Dedupe_Merger::moveAllBelongings()": "toxicAlert",
+    "CRM_Event_Form_ManageEvent_Fee::formRule()": "toxicAlert",
+    "CRM_Event_Form_Participant::submit()": "toxicAlert",
     "CRM_Event_Form_Registration_Confirm::postProcess()": "toxicAlert",
-    "CRM_Event_BAO_Event::displayProfile()": "toxicAlert",
-    "CRM_Contribute_Form_Contribution_Confirm::postProcess()": "toxicAlert"
+    "CRM_Event_Form_Registration_Register::buildQuickForm()": "toxicAlert",
+    "CRM_Event_Form_Registration_Register::postProcess()": "toxicAlert",
+    "CRM_Export_BAO_Export::exportComponents()": "toxicAlert",
+    "CRM_Mailing_BAO_Mailing::compose()": "toxicAlert",
+    "CRM_Mailing_BAO_Mailing::getRecipients()": "toxicAlert",
+    "CRM_Mailing_BAO_Mailing::report()": "toxicAlert",
+    "CRM_Member_Form_Membership::formRule()": "toxicAlert",
+    "CRM_Member_Form_Membership::submit()": "toxicAlert",
+    "CRM_PCP_Page_PCPInfo::run()": "toxicAlert",
+    "CRM_Price_BAO_PriceField::addQuickFormElement()": "toxicAlert",
+    "CRM_Price_Form_Field::formRule()": "toxicAlert",
+    "CRM_Profile_Form::buildQuickForm()": "toxicAlert",
+    "CRM_Profile_Form::postProcess()": "toxicAlert",
+    "CRM_Profile_Form::preProcess()": "toxicAlert",
+    "CRM_Profile_Page_Dynamic::run()": "toxicAlert",
+    "CRM_Report_Form_Contact_Detail::__construct()": "toxicAlert",
+    "CRM_Report_Form_Contribute_Bookkeeping::__construct()": "toxicAlert",
+    "CRM_Report_Form_Contribute_Detail::__construct()": "toxicAlert",
+    "CRM_Report_Form_Event_ParticipantListing::__construct()": "toxicAlert",
+    "CRM_Report_Form_Member_ContributionDetail::__construct()": "toxicAlert",
+    "CRM_UF_Form_Field::buildQuickForm()": "toxicAlert",
+    "CRM_Upgrade_Incremental_php_FourThree::createFinancialRecords()": "toxicAlert",
+    "CRM_Utils_Date::relativeToAbsolute()": "toxicAlert",
+    "CRM_Utils_Mail_EmailProcessor::_process()": "toxicAlert",
+    "ImportCiviSeleniumTestCase::importContacts()": "toxicAlert",
+    "WebTest_Contribute_OnBehalfOfOrganization::_testUserWithMoreThanOneRelationship()": "toxicAlert",
+    "WebTest_Profile_BatchUpdateTest::testBatchUpdate()": "toxicAlert",
+    "api_v3_JobTest::getMergeLocations()": "toxicAlert",
+    "api_v3_JobTest::getMergeSets()": "toxicAlert"
   }
 }
\ No newline at end of file