get useful checks from tricks/code-checker/code-checker.php

greggles - September 11, 2007 - 18:15
Project:Coder
Version:5.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

http://cvs.drupal.org/viewvc.py/drupal/contributions/tricks/code-checker...

Perhaps these are all included, but if not it's a great source of tests (including security).

#1

stella - November 21, 2007 - 14:45

All of the tests are already in coder except for the following:

  1. Check that "INSERT INTO" statements have at least one set of "(...)" following - I guess this could be seen as an ANSI SQL test, for example it's possible to use "INSERT INTO foo SET a='abc';" in MySQL, but it's not part of the ANSI SQL standard.
  2. Check that "INSERT INTO" statements have two "(...)" following, i.e. one containing list of column names and the other the values. I don't believe this is invalid SQL and (iirc) it's not a recommendation in the drupal SQL standards, but personally I would prefer this more explicit method of inserts.
  3. Check that the number of values matches the number of column names in all INSERTs - I don't think there is an easy way of implementing this in coder (could be wrong) but the database will throw an error in such instances and the code won't work.

Cheers,
Stella

#2

stella - November 21, 2007 - 14:49

Doug - Let me know if you want me to write rules for any of the above.

Cheers,
Stella

 
 

Drupal is a registered trademark of Dries Buytaert.