Qual: Normalize code

This commit is contained in:
Laurent Destailleur 2010-07-21 17:14:45 +00:00
parent 3d14382d4c
commit 3388764b14
11 changed files with 107 additions and 89 deletions

View File

@ -20,8 +20,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.php.core.PHPNature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures>
</projectDescription>

View File

@ -1,8 +1,8 @@
#Thu Jun 24 20:12:23 CEST 2010
#Wed Jul 21 18:10:37 CEST 2010
eclipse.preferences.version=1
org.eclipse.php.debug.core.use-project-settings=true
org.eclipse.php.debug.coredefaultPHP=PHP Wamp 5.2.8
org.eclipse.php.debug.coreoutput_encoding=
org.eclipse.php.debug.coredefaultPHP=PHP Wamp 5.3.0
org.eclipse.php.debug.coreoutput_encoding=UTF-8
org.eclipse.php.debug.corephp_debugger_id=org.eclipse.php.debug.core.xdebugDebugger
org.eclipse.php.debug.corestop_at_first_line_string=true
org.eclipse.php.debug.coretransfer_encoding=
org.eclipse.php.debug.coretransfer_encoding=UTF-8

View File

@ -13,4 +13,9 @@ Set path ro run.php file for localhost
Choose a PHP version,
Set parameter string with
--src %f --config "phpstandard.cfg.xml" --format console
Choose php as Filename extension
Choose php as Filename extension
Check Print PHP output to console
Then add patern
* %f INFO Line:%n - %m Warning
* %f WARNING Line:%n - %m Warning
* %f ERROR Line:%n - %m Error

View File

@ -1,18 +1,20 @@
<!-- somewhat inspired by java checkstyle -->
<phpcheckstyle-configuration>
<!-- **************** -->
<!-- **************** -->
<!-- Naming -->
<!-- **************** -->
<!-- Check Constant Naming -->
<!-- Disabled to avoid warning with $sql="SELECT ..."
<test name="constantNaming" regexp="/^[A-Z_][A-Z_]*[A-Z_]$/" level="ERROR"/>
-->
<!-- Check Variable Naming -->
<test name="variableNaming" regexp="/^[a-z_][a-zA-Z0-9]*$/" />
<!-- Check Function Naming -->
<test name="functionNaming" regexp="/^[a-z]/" level="ERROR"/>
<test name="functionNaming" regexp="/^[a-z_]/" level="ERROR"/>
<!-- Check Private Function Naming -->
<test name="privateFunctionNaming" regexp="/^_[a-z]/" level="ERROR"/>
@ -28,7 +30,7 @@
<test name="classNaming" regexp="/^[A-Z]/" level="ERROR"/>
<!-- **************** -->
<!-- **************** -->
<!-- PHP Tags -->
<!-- **************** -->
@ -37,7 +39,7 @@
<test name="noShortPhpCodeTag"/>
<!-- Test if a PHP closing file is present at the end of a file -->
<test name="noFileCloseTag"/>
<!-- <test name="noFileCloseTag"/> -->
<!-- Test if a file finish with some inner HTML (OK for some view but could provoque "header already sent" error) -->
<test name="noFileFinishHTML" level="ERROR" />
@ -47,7 +49,7 @@
<!-- Comments -->
<!-- **************** -->
<!-- Check if some C style comments are used (#) -->
<!-- Check if some C style comments are used (#) -->
<test name="noShellComments"/>
<!-- Tests that every function and class is immediately preceded by a docblock. A property "excludePrivateMembers" can be set if you want to disable docblocks for private member functions. -->
@ -72,7 +74,7 @@
<!-- sl = same line -->
<!-- nl = new line -->
<test name="controlStructOpenCurly">
<property name="position" value="sl"/>
<property name="position" value="nl"/>
</test>
<!-- Check the position of the close curly brace -->
@ -82,18 +84,16 @@
<!-- Check the position of the open curly brace after a function -->
<!-- sl = same line -->
<!-- nl = new line -->
<!--
<test name="funcDefinitionOpenCurly">
<property name="position" value="sl"/>
<property name="position" value="nl"/>
</test>
-->
<!-- Check the position of the else -->
<!-- sl = same line -->
<!-- Check the position of the else -->
<!-- sl = same line -->
<!-- nl = new line -->
<test name="controlStructElse">
<property name="position" value="nl"/>
</test>
<property name="position" value="nl"/>
</test>
<!-- **************** -->
@ -108,27 +108,34 @@
<!-- Check that there is no space after a function name in a function call -->
<!-- <test name="noSpaceAfterFunctionName" level="INFO"></test> -->
<!-- Check for the (required) presence of a white space after some tokens (like ,) -->
<!--
<test name="checkWhiteSpaceAfter">
<exception value="."/> <!-- Exceptions to this rule -->
<exception value="."/>
</test>
-->
<!-- Check for the (required) presence of a white space before some tokens -->
<!--
<test name="checkWhiteSpaceBefore">
<exception value="."/> <!-- Exceptions to this rule -->
<exception value=":"/> <!-- Because of the switch/case -->
<exception value="."/>
<exception value=":"/>
</test>
-->
<!-- Check that there is no space before before some tokens -->
<!--
<test name="noSpaceBeforeToken" level="INFO">
</test>
-->
<!-- Check that there is no space after some tokens -->
<!--
<test name="noSpaceAfterToken" level="INFO">
</test>
-->
<!-- **************** -->
<!-- Metrics -->
@ -150,8 +157,8 @@
</test> -->
<!-- Check Cyclomatic Complexity -->
<!-- see http://www.aivosto.com/project/help/pm-complexity.html -->
<test name="cyclomaticComplexity">
<!-- see http://www.aivosto.com/project/help/pm-complexity.html -->
<test name="cyclomaticComplexity">
<!-- Level raising a warning -->
<property name="warningLevel" value="10"/>
<!-- Level raising an error -->
@ -168,50 +175,50 @@
<!-- Check for prohibited functions -->
<!-- @see http://www.php.net/manual/en/indexes.php -->
<test name="checkProhibitedFunctions">
<item value="echo"/>
<item value="system"/>
<item value="print_r"/>
<item value="var_dump"/>
<item value="dl"/>
<item value="exec"/>
<item value="passthru"/>
<item value="delete"/>
<item value="ereg_replace"/>
<item value="ereg"/>
<item value="eregi"/>
<!-- <item value="copy"/> -->
<!-- <item value="fwrite"/> -->
<item value="echo"/>
<item value="system"/>
<item value="print_r"/>
<item value="var_dump"/>
<item value="dl"/>
<!--<item value="exec"/>-->
<item value="passthru"/>
<!-- <item value="delete"/> We disable because of false report when using method delete -->
<item value="ereg_replace"/>
<item value="ereg"/>
<item value="eregi"/>
<!-- <item value="copy"/> -->
<!-- <item value="fwrite"/> -->
</test>
<!-- Check for prohibited tokens -->
<!-- @see http://www.php.net/manual/en/tokens.php -->
<test name="checkProhibitedTokens">
<item value="T_BAD_CHARACTER"/>
<item value="T_DECLARE"/>
<item value="T_ENDDECLARE"/>
<item value="T_ENDFOR"/>
<item value="T_ENDFOREACH"/>
<item value="T_ENDIF"/>
<item value="T_ENDSWITCH"/>
<item value="T_ENDWHILE"/>
<item value="T_HALT_COMPILER"/>
<item value="T_OLD_FUNCTION"/>
<item value="T_PRINT"/>
<!-- Same thing as the noShortPhpCodeTag rule -->
<!-- <item value="T_OPEN_TAG_WITH_ECHO"/> -->
<!-- <item value="T_INLINE_HTML"/> -->
<!-- <item value="T_ECHO"/> -->
<item value="T_BAD_CHARACTER"/>
<item value="T_DECLARE"/>
<item value="T_ENDDECLARE"/>
<item value="T_ENDFOR"/>
<item value="T_ENDFOREACH"/>
<item value="T_ENDIF"/>
<item value="T_ENDSWITCH"/>
<item value="T_ENDWHILE"/>
<item value="T_HALT_COMPILER"/>
<item value="T_OLD_FUNCTION"/>
<!-- <item value="T_PRINT"/> -->
<!-- Same thing as the noShortPhpCodeTag rule -->
<!-- <item value="T_OPEN_TAG_WITH_ECHO"/> -->
<!-- <item value="T_INLINE_HTML"/> -->
<!-- <item value="T_ECHO"/> -->
</test>
<!-- Check for silenced errors before function calls (@function) -->
<test name="checkSilencedError">
<exception value="rename"/> <!-- Exceptions to this rule -->
<exception value="mkdir"/>
<exception value="chmod"/>
<exception value="rename"/> <!-- Exceptions to this rule -->
<exception value="mkdir"/>
<exception value="chmod"/>
</test>
<!-- Check for encapsed variables inside a String ("$a") -->
@ -231,7 +238,7 @@
<!-- Check empty block like if ($a) {} -->
<test name="checkEmptyBlock">
<!-- <exception value="catch"/> -->
<!-- <exception value="catch"/> -->
</test>
<!-- Check empty statement ( ;; ) -->
@ -264,7 +271,7 @@
With the exception of for iterators, all variable incrementation or decrementation should occur in their own toplevel statement to increase readability.
-->
<test name="checkUnaryOperator">
<exception value="for"/>
<exception value="for"/>
</test>
<!--
@ -272,7 +279,7 @@
With the exception of for iterators, all assignments should occur in their own toplevel statement to increase readability.
-->
<test name="checkInnerAssignment">
<exception value="for"/>
<exception value="for"/>
</test>
<!-- Detect unused private functions (detecting unused public ones is more difficult) -->

View File

@ -20,7 +20,7 @@
*/
/**
* \file htdocs/compta/export/class/ComptaJournalPaiement.php
* \file htdocs/compta/export/class/ComptaJournalPaiement.class.php
* \ingroup compta
* \brief Fichier de la classe export compta journal
* \version $Id$
@ -40,7 +40,7 @@ class ComptaJournalPaiement
$this->db = $db;
}
function GeneratePdf($user, $dir, $excid, $excref)
function generatePdf($user, $dir, $excid, $excref)
{
global $conf,$langs;

View File

@ -18,7 +18,7 @@
*/
/**
* \file htdocs/compta/export/class/ComptaJournalPdf.php
* \file htdocs/compta/export/class/ComptaJournalPdf.class.php
* \ingroup compta
* \brief Fichier de la classe export compta journal
* \version $Id$

View File

@ -19,7 +19,7 @@
*/
/**
\file htdocs/compta/export/classComptaJournalVente.php
\file htdocs/compta/export/class/ComptaJournalVente.class.php
\ingroup compta
\brief Fichier de la classe export compta journal
\version $Id$
@ -40,7 +40,7 @@ class ComptaJournalVente {
}
function GeneratePdf($user, $dir, $excid, $excref)
function generatePdf($user, $dir, $excid, $excref)
{
global $conf, $langs;

View File

@ -72,12 +72,12 @@ if ($_GET["action"] == 'export')
/* G<>n<EFBFBD>ration du journal des Paiements */
$jp= new ComptaJournalPaiement($db);
$jp->GeneratePdf($user, $dir, $exc->id, $exc->ref);
$jp->generatePdf($user, $dir, $exc->id, $exc->ref);
/* G<>n<EFBFBD>ration du journal des Ventes */
$jp= new ComptaJournalVente($db);
$jp->GeneratePdf($user, $dir, $exc->id, $exc->ref);
$jp->generatePdf($user, $dir, $exc->id, $exc->ref);
}
/*

View File

@ -62,7 +62,7 @@ class RemiseCheque extends CommonObject
* \param ref Ref record
* \return int <0 if KO, >= 0 if OK
*/
function Fetch($id,$ref='')
function fetch($id,$ref='')
{
global $conf;
@ -117,7 +117,7 @@ class RemiseCheque extends CommonObject
* \param account_id Compte bancaire concerne
* \return int <0 if KO, >0 if OK
*/
function Create($user, $account_id)
function create($user, $account_id)
{
global $conf;
@ -220,7 +220,7 @@ class RemiseCheque extends CommonObject
if ($this->id > 0 && $this->errno == 0)
{
if ($this->UpdateAmount() <> 0)
if ($this->updateAmount() <> 0)
{
$this->errno = -1027;
dol_syslog("RemiseCheque::Create ERREUR ($this->errno)");
@ -254,7 +254,7 @@ class RemiseCheque extends CommonObject
\brief Supprime la remise en base
\param user utilisateur qui effectue l'operation
*/
function Delete($user='')
function delete($user='')
{
global $conf;
@ -308,7 +308,7 @@ class RemiseCheque extends CommonObject
* \brief Validate receipt
* \param user User
*/
function Validate($user)
function validate($user)
{
global $langs,$conf;
@ -530,7 +530,7 @@ class RemiseCheque extends CommonObject
* \brief Mets a jour le montant total
* \return int, 0 en cas de succes
*/
function UpdateAmount()
function updateAmount()
{
global $conf;
@ -563,13 +563,13 @@ class RemiseCheque extends CommonObject
if (!$resql)
{
$this->errno = -1030;
dol_syslog("RemiseCheque::UpdateAmount ERREUR UPDATE ($this->errno)");
dol_syslog("RemiseCheque::updateAmount ERREUR UPDATE ($this->errno)");
}
}
else
{
$this->errno = -1031;
dol_syslog("RemiseCheque::UpdateAmount ERREUR SELECT ($this->errno)");
dol_syslog("RemiseCheque::updateAmount ERREUR SELECT ($this->errno)");
}
if ($this->errno === 0)
@ -579,7 +579,7 @@ class RemiseCheque extends CommonObject
else
{
$this->db->rollback();
dol_syslog("RemiseCheque::UpdateAmount ROLLBACK ($this->errno)");
dol_syslog("RemiseCheque::updateAmount ROLLBACK ($this->errno)");
}
return $this->errno;
@ -590,7 +590,7 @@ class RemiseCheque extends CommonObject
\param user utilisateur qui effectue l'operation
\param account_id Compte bancaire concerne
*/
function RemoveCheck($account_id)
function removeCheck($account_id)
{
$this->errno = 0;
@ -604,12 +604,12 @@ class RemiseCheque extends CommonObject
$resql = $this->db->query($sql);
if ($resql)
{
$this->UpdateAmount();
$this->updateAmount();
}
else
{
$this->errno = -1032;
dol_syslog("RemiseCheque::RemoveCheck ERREUR UPDATE ($this->errno)");
dol_syslog("RemiseCheque::removeCheck ERREUR UPDATE ($this->errno)");
}
}
return 0;

View File

@ -111,7 +111,7 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' &&
if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' && $user->rights->banque->cheque)
{
$remisecheque = new RemiseCheque($db);
$result = $remisecheque->Fetch($_GET["id"]);
$result = $remisecheque->fetch($_GET["id"]);
$result = $remisecheque->Validate($user);
if ($result >= 0)
{
@ -127,7 +127,7 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' &&
if ($_POST['action'] == 'builddoc' && $user->rights->banque->cheque)
{
$remisecheque = new RemiseCheque($db);
$result = $remisecheque->Fetch($_GET["id"]);
$result = $remisecheque->fetch($_GET["id"]);
/*if ($_REQUEST['model'])
{
@ -141,7 +141,7 @@ if ($_POST['action'] == 'builddoc' && $user->rights->banque->cheque)
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
$result = $remisecheque->GeneratePdf($_POST["model"], $outputlangs);
$result = $remisecheque->generatePdf($_POST["model"], $outputlangs);
if ($result <= 0)
{
dol_print_error($db,$remisecheque->error);

View File

@ -84,7 +84,7 @@ if ($_POST["action"] == 'infotrans')
if ($_POST["action"] == 'infocredit')
{
$bon = new BonPrelevement($db,"");
$bon->Fetch($_GET["id"]);
$bon->fetch($_GET["id"]);
$dt = mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
$error = $bon->set_infocredit($user, $dt);