« Previous - Version 11/25 (diff) - Next » - Current version
Stefano Kowalke, 2010-10-15 23:14


Subversion structure / Checkout our codesniffs

In general

The coding standards

Structure:

|- CodingStandardName
  |- branches
  |- tags
    |- CodingStandardName_Majorversion-Minorversion-Serviceversion 
  |- trunk
    |- Sniffs
    |- Tests
    |- ruleset.xml

Example:

|- TYPO3
  |- branches
  |- tags
    |- TYPO3_0-0-1 
  |- trunk
    |- Sniffs
    |- Tests
    |- ruleset.xml

|- TYPO3v4
  |- branches
  |- tags
    |- TYPO3v4_0-0-1 
  |- trunk
    |- ruleset.xml

The PHP_CodeSniffer-trunk with our coding standards

At the root folder of our repository (http://forge.typo3.org/projects/team-php_codesniffer/repository) we have created some "svn:external" properties.
One for the current trunk of PEAR package "PHP_CodeSniffer" and three others to include our coding standards into the current trunk.

For developer / contributer

If you are a user who want to develop / contribute / play arount with the full copy of our development cycle, you need to install PEAR include PHP_CodeSniffer >= version 1.3.0RC1.

Please checkout our complete repository from our root-folder: http://forge.typo3.org/projects/team-php_codesniffer/repository

SVN

$svn co https://svn.typo3.org/Teams/forge.typo3.org/hudson-helpers/tools/PHP_CodeSniffer/

GIT

Git can't deal with svn:externals out of the box. The best solution I found is a ruby/perl script which you can found here http://github.com/liyanage/git-tools/. The usage of the script could found in the file itself, but for a quick overview, I will explain it here.
  1. Clone the source:
    git svn clone https://svn.typo3.org/Teams/forge.typo3.org/hudson-helpers/tools/PHP_CodeSniffer/
    
  2. Change directory to the new working copy and run the script:
    /relative/path/to/git-svn-clone-externals.rb
    

    This fetches the svn:externals and in case of the PHP_Codesniffer it will take a long time.

Next to the coding standards (FLOW3, TYPO3, TYPO3v4) there will be a "CodeSniffer"-folder.
This folder includes the complete trunk of PEAR-package "PHP_CodeSniffer".
You need this trunk to run our unit tests for the coding standards.

Now you must symlink the coding standards into your normal PHP_CodeSniffer-installation.

For example:
  • PHP_CodeSniffer version 1.3.0RC1 installed
  • PEAR-Path: /usr/lib/pear
  • Checkout-Path: /Users/dummy/Development/CodeSniffer

Normaly, your "Standards"-directory is in "/usr/lib/pear/PHP/CodeSniffer/Standards".
If this is true, you could symlink the standards:

ln -s /Users/dummy/Development/CodeSniffer/CodeSniffer/Standards/FLOW3 /usr/lib/pear/PHP/CodeSniffer/Standards/FLOW3
ln -s /Users/dummy/Development/CodeSniffer/CodeSniffer/Standards/TYPO3 /usr/lib/pear/PHP/CodeSniffer/Standards/TYPO3
ln -s /Users/dummy/Development/CodeSniffer/CodeSniffer/Standards/TYPO3v4 /usr/lib/pear/PHP/CodeSniffer/Standards/TYPO3v4 

With "phpcs -i" you could verify if the standards are installed.

To run the unit tests you must fire the following command (PHPUnit must be installed!):

phpunit /Users/dummy/Development/CodeSniffer/CodeSniffer/tests/AllTests.php

For users

If you are a user who want to use / test / play around with our coding standards and you want to use a development or old version of this standards, you need to install PEAR incluse PHP_CodeSniffer >= version 1.3.0RC1.

Now you could checkout your favorite version into the "Standards"-directory of your PEAR-Package: For example:
  • PHP_CodeSniffer version 1.3.0RC1 installed
  • PEAR-Path: /usr/lib/pear
  • Favorite CodingStandard: FLOW3-trunk

Normaly, your "Standards"-directory is in "/usr/lib/pear/PHP/CodeSniffer/Standards".
If this is true checkout the trunk of "TYPO3" (Sniffpool) and FLOW3-CodingStandard:

svn co https://svn.typo3.org/Teams/forge.typo3.org/hudson-helpers/tools/PHP_CodeSniffer/TYPO3/trunk/ TYPO3
svn co https://svn.typo3.org/Teams/forge.typo3.org/hudson-helpers/tools/PHP_CodeSniffer/FLOW3/trunk/ FLOW3

With "phpcs -i" you could verify if the standards are installed.