Qual: Optimize PHP Code sniffer rules
This commit is contained in:
parent
69892eccf8
commit
76a6d6a6fe
@ -33,7 +33,7 @@
|
|||||||
<!-- Lines can be 85 chars long, but never show errors -->
|
<!-- Lines can be 85 chars long, but never show errors -->
|
||||||
<rule ref="Generic.Files.LineLength">
|
<rule ref="Generic.Files.LineLength">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="lineLimit" value="320" />
|
<property name="lineLimit" value="1000" />
|
||||||
<property name="absoluteLineLimit" value="0" />
|
<property name="absoluteLineLimit" value="0" />
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
@ -169,8 +169,14 @@
|
|||||||
<rule ref="PEAR.Functions.ValidDefaultValue" />
|
<rule ref="PEAR.Functions.ValidDefaultValue" />
|
||||||
|
|
||||||
<rule ref="PEAR.NamingConventions.ValidClassName" />
|
<rule ref="PEAR.NamingConventions.ValidClassName" />
|
||||||
|
<rule ref="PEAR.NamingConventions.ValidClassName.StartWithCaptial">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
|
||||||
<rule ref="PEAR.NamingConventions.ValidFunctionName" />
|
<rule ref="PEAR.NamingConventions.ValidFunctionName" />
|
||||||
|
<rule ref="PEAR.NamingConventions.ValidFunctionName.NotCamelCaps">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
|
||||||
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCaptial">
|
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCaptial">
|
||||||
<severity>0</severity>
|
<severity>0</severity>
|
||||||
|
|||||||
@ -151,7 +151,7 @@ $targetcontent=$sourcecontent;
|
|||||||
$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent);
|
$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent);
|
||||||
$targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
|
$targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
|
||||||
$targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);
|
$targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);
|
||||||
$targetcontent=preg_replace('/Skeleton_class/', $classname, $targetcontent);
|
$targetcontent=preg_replace('/Skeleton_Class/', $classname, $targetcontent);
|
||||||
|
|
||||||
// Substitute comments
|
// Substitute comments
|
||||||
$targetcontent=preg_replace('/This file is an example to create a new class file/', 'Put here description of this class', $targetcontent);
|
$targetcontent=preg_replace('/This file is an example to create a new class file/', 'Put here description of this class', $targetcontent);
|
||||||
@ -206,7 +206,7 @@ foreach($property as $key => $prop)
|
|||||||
if ($addfield)
|
if ($addfield)
|
||||||
{
|
{
|
||||||
$varprop.="\t\t\$sql.= \"".$prop['field'];
|
$varprop.="\t\t\$sql.= \"".$prop['field'];
|
||||||
if ($i < sizeof($property)) $varprop.=",";
|
if ($i < count($property)) $varprop.=",";
|
||||||
$varprop.="\";";
|
$varprop.="\";";
|
||||||
$varprop.="\n";
|
$varprop.="\n";
|
||||||
}
|
}
|
||||||
@ -233,7 +233,7 @@ foreach($property as $key => $prop)
|
|||||||
$varprop.='".(! isset($this->'.$prop['field'].') || dol_strlen($this->'.$prop['field'].')==0?\'NULL\':$this->db->idate(';
|
$varprop.='".(! isset($this->'.$prop['field'].') || dol_strlen($this->'.$prop['field'].')==0?\'NULL\':$this->db->idate(';
|
||||||
$varprop.="\$this->".$prop['field']."";
|
$varprop.="\$this->".$prop['field']."";
|
||||||
$varprop.='))."';
|
$varprop.='))."';
|
||||||
if ($i < sizeof($property)) $varprop.=",";
|
if ($i < count($property)) $varprop.=",";
|
||||||
$varprop.="\";";
|
$varprop.="\";";
|
||||||
}
|
}
|
||||||
elseif ($prop['ischar'])
|
elseif ($prop['ischar'])
|
||||||
@ -241,7 +241,7 @@ foreach($property as $key => $prop)
|
|||||||
$varprop.='".(! isset($this->'.$prop['field'].')?\'NULL\':"\'".';
|
$varprop.='".(! isset($this->'.$prop['field'].')?\'NULL\':"\'".';
|
||||||
$varprop.='$this->db->escape($this->'.$prop['field'].')';
|
$varprop.='$this->db->escape($this->'.$prop['field'].')';
|
||||||
$varprop.='."\'")."';
|
$varprop.='."\'")."';
|
||||||
if ($i < sizeof($property)) $varprop.=",";
|
if ($i < count($property)) $varprop.=",";
|
||||||
$varprop.='";';
|
$varprop.='";';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -249,7 +249,7 @@ foreach($property as $key => $prop)
|
|||||||
$varprop.='".(! isset($this->'.$prop['field'].')?\'NULL\':"\'".';
|
$varprop.='".(! isset($this->'.$prop['field'].')?\'NULL\':"\'".';
|
||||||
$varprop.="\$this->".$prop['field']."";
|
$varprop.="\$this->".$prop['field']."";
|
||||||
$varprop.='."\'")."';
|
$varprop.='."\'")."';
|
||||||
if ($i < sizeof($property)) $varprop.=",";
|
if ($i < count($property)) $varprop.=",";
|
||||||
$varprop.='";';
|
$varprop.='";';
|
||||||
}
|
}
|
||||||
$varprop.="\n";
|
$varprop.="\n";
|
||||||
@ -287,7 +287,7 @@ foreach($property as $key => $prop)
|
|||||||
$varprop.=".\"";
|
$varprop.=".\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($i < sizeof($property)) $varprop.=',';
|
if ($i < count($property)) $varprop.=',';
|
||||||
$varprop.='";';
|
$varprop.='";';
|
||||||
$varprop.="\n";
|
$varprop.="\n";
|
||||||
}
|
}
|
||||||
@ -306,7 +306,7 @@ foreach($property as $key => $prop)
|
|||||||
{
|
{
|
||||||
$varprop.="\t\t\$sql.= \" ";
|
$varprop.="\t\t\$sql.= \" ";
|
||||||
$varprop.="t.".$prop['field'];
|
$varprop.="t.".$prop['field'];
|
||||||
if ($i < sizeof($property)) $varprop.=",";
|
if ($i < count($property)) $varprop.=",";
|
||||||
$varprop.="\";";
|
$varprop.="\";";
|
||||||
$varprop.="\n";
|
$varprop.="\n";
|
||||||
}
|
}
|
||||||
@ -385,7 +385,7 @@ $targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.ph
|
|||||||
$targetcontent=preg_replace('/skeleton_script\.php/', $classmin.'_script.php', $targetcontent);
|
$targetcontent=preg_replace('/skeleton_script\.php/', $classmin.'_script.php', $targetcontent);
|
||||||
$targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
|
$targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
|
||||||
$targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);
|
$targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);
|
||||||
$targetcontent=preg_replace('/Skeleton_class/', $classname, $targetcontent);
|
$targetcontent=preg_replace('/Skeleton_Class/', $classname, $targetcontent);
|
||||||
|
|
||||||
// Substitute comments
|
// Substitute comments
|
||||||
$targetcontent=preg_replace('/This file is an example to create a new class file/', 'Put here description of this class', $targetcontent);
|
$targetcontent=preg_replace('/This file is an example to create a new class file/', 'Put here description of this class', $targetcontent);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -38,8 +38,9 @@ include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
|
|||||||
class modMyModule extends DolibarrModules
|
class modMyModule extends DolibarrModules
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* \brief Constructor. Define names, constants, directories, boxes, permissions
|
* Constructor. Define names, constants, directories, boxes, permissions
|
||||||
* \param DB Database handler
|
*
|
||||||
|
* @param DoliDB $DB Database handler
|
||||||
*/
|
*/
|
||||||
function modMyModule($DB)
|
function modMyModule($DB)
|
||||||
{
|
{
|
||||||
@ -232,7 +233,8 @@ class modMyModule extends DolibarrModules
|
|||||||
/**
|
/**
|
||||||
* Function called when module is enabled.
|
* Function called when module is enabled.
|
||||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
* It also creates data directories.
|
* It also creates data directories
|
||||||
|
*
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init()
|
function init()
|
||||||
@ -247,7 +249,8 @@ class modMyModule extends DolibarrModules
|
|||||||
/**
|
/**
|
||||||
* Function called when module is disabled.
|
* Function called when module is disabled.
|
||||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||||
* Data directories are not deleted.
|
* Data directories are not deleted
|
||||||
|
*
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function remove()
|
function remove()
|
||||||
@ -259,11 +262,12 @@ class modMyModule extends DolibarrModules
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Create tables, keys and data required by module
|
* Create tables, keys and data required by module
|
||||||
* Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
|
* Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
|
||||||
* and create data commands must be stored in directory /mymodule/sql/
|
* and create data commands must be stored in directory /mymodule/sql/
|
||||||
* This function is called by this->init.
|
* This function is called by this->init
|
||||||
* \return int <=0 if KO, >0 if OK
|
*
|
||||||
|
* @return int <=0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function load_tables()
|
function load_tables()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class Skeleton_class
|
* \class Skeleton_Class
|
||||||
* \brief Put here description of your class
|
* \brief Put here description of your class
|
||||||
* \remarks Put here some comments
|
* \remarks Put here some comments
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user