Like Chris said, efforts to go back and clean up have been incomplete. That said, I might just go in and fix some of these.
Looking through, > 23:Functions follow the same rules as variables: should be all-lowercase > with words separated by underscores. Do not use camelCaseNames.. > const HABARI_SVN_HEAD_URL = > '$HeadURL:https://svn.habariproject.org/habari/trunk constants are to be all caps. > 61:Boolean values should be referenced by name and in all capital letters. > * @return boolean True if this is a development version, false if not I'm not sure the standards apply to (PHPDoc) comments. This should be a useful check, whether it's done with this testing or some sort of code sniffing. Thanks! mikelietz On Sep 29, 12:32 pm, Iñaki Lopez <[email protected]> wrote: > Hi all. While I'm working on the new testing framework I'd like to go with > eac core file (there are not too much) not only reviewing the tests, but > also fixing possible bugs, or even that so called: coding standards. What > I've found is that not only the wiki is a little bit incomplete > (http://wiki.habariproject.org/en/Dev:Coding_Standards), but also core does > not follow its own rules. I'm making a script using regex to validate that > code (not only core, but also extras) comply with the coding standards. I'll > working on different reviews: > - Basic coding standard review (sintax and so) > - Usage of PHP 5.3 deprecated functions in code > - Correct definition of hook implementations (to avoid problems like this > onehttp://wiki.habariproject.org/en/Dev:Coding_Standards) > - ... > > The problem is that as long as the coding standards is not complete, I won't > go further than my self 'idea' of what is suppossed to be good coding > standard. > > I've commited the two first files definitions > (https://trac.habariproject.org/habari/changeset/4359), sorry, I forgot the > description during the commit. Some of the checks are easy to write, others > not. > > I run the script over the 'version.php' file, this is a little one, and > these are the results: > > It is in the format: line_number:description, followed by a copy of the > line. > > 23:Functions follow the same rules as variables: should be all-lowercase > with words separated by underscores. Do not use camelCaseNames.. > const HABARI_SVN_HEAD_URL = > '$HeadURL:https://svn.habariproject.org/habari/trunk/htdocs/system/classes/vers... > > 25:Functions follow the same rules as variables: should be all-lowercase > with words separated by underscores. Do not use camelCaseNames.. > const HABARI_SVN_REV = '$Revision: 4226 $'; > > 61:Boolean values should be referenced by name and in all capital letters. > * @return boolean True if this is a development version, false if not > > 65:You should use an space after an opening parenthesis. > 65:You should use an space before a closing parenthesis. > 65:Boolean values should be referenced by name and in all capital letters. > return strpos(Version::HABARI_SVN_HEAD_URL, '/trunk/') !== false || > strpos(Version::HABARI_SVN_HEAD_URL, '/branches/') !== false; > > 73:You should use an space after an opening parenthesis. > 73:You should use an space before a closing parenthesis. > Options::set('db_version', Version::DB_VERSION); > > 83:You should use an space betwen a closing parenthesis and an opening > bracket. > 83:You should use an space after an opening parenthesis. > 83:You should use an space before a closing parenthesis. > if (Options::get('db_version') < Version::DB_VERSION){ > > 84:Boolean values should be referenced by name and in all capital letters. > return true; > > 86:Boolean values should be referenced by name and in all capital letters. > return false; > > 99:You should use an space after an opening parenthesis. > 99:You should use an space before a closing parenthesis. > 99:Conditional statements should have an space separator between the control > statement and the opening parenthesis. > if(file_exists($stash_file)) { > > 100:You should use an space after an opening parenthesis. > 100:You should use an space before a closing parenthesis. > $info = file_get_contents($stash_file); > > 101:You should use an space after an opening parenthesis. > 101:You should use an space before a closing parenthesis. > $info = explode("\n", $info); > > 102:You should use an space after an opening parenthesis. > 102:You should use an space before a closing parenthesis. > 102:Conditional statements should have an space separator between the > control statement and the opening parenthesis. > 102:Boolean values should be referenced by name and in all capital letters. > if(strpos($info[4], 'svn.habariproject.org/habari/') !== false) { > > 103:You should use an space after an opening parenthesis. > 103:You should use an space before a closing parenthesis. > $rev = intval(trim($info[3])); > > 106:You should use an space after an opening parenthesis. > 106:You should use an space before a closing parenthesis. > 106:Conditional statements should have an space separator between the > control statement and the opening parenthesis. > if($rev == 0) { > > 107:You should use an space after an opening parenthesis. > 107:You should use an space before a closing parenthesis. > $rev = intval(preg_replace('/[^0-9]/', '', Version::HABARI_SVN_REV)); > > Just FYI -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/habari-dev
