blog.Resource

Archive:

News-Feeds:


RSS 2.0
RSS 0.91
RDF
ATOM 0.3
May 8, 2013

News from the TYPO3 Codesniffer

Category: Quality Assurance

By: Stefano Kowalke

Introduction

On Saturday, the 4th of may, I released a new version of the TYPO3 Codesniffer standard for TYPO3CMS and TYPO3Flow. I am writing this article to reach a bigger audience because it is not just another release. It breaks with old infrastructure, naming and distributing.

Releasing this version means an improvement for the further development, changes the installation a little bit and means a lot for me personally.

Some history

After the Quality Assurance Sprint in Linz last year I started with implementing Composer support for the standards. At this time the standards reside within one git repository on forge.typo3.org. That works well with PEAR because it already handles the standards as three packages and it also works for git clones by symlinking the single standards into the PHP_CodeSniffer standards folder - but it doesn't work for Composer. In order to make it work with Composer we have to split the repository into three.

Splitting the standard

Why three? Because we have three standards:

  • one standard which contains all sniff files and its tests - the TYPO3SniffPool
  • a standard for the TYPO3CMS - TYPO3CMS
  • a standard for the TYPO3Flow project - TYPO3Flow

While I thought about this topic, we (Andy Grunwald and me aka the team aka we) decided this is also a good moment to move the repository to github. There are various reasons for the move:

  • we can't handle three different respositories within one Forge project
  • it makes pull requests for contributors available
  • the contributor doesn't have to belong to the TYPO3 community - there is no Forge account necessary
  • it is easier for us to merge it into the codebase

Renaming

During this time the rebranding took place and the names of TYPO3v4, FLOW3 and TYPO3v5 changed into that what we know today. I was and I am still not a fan of this change, to the point where it demotivated me and was a large contributing factor as to why I stopped working on this project for five months.

But for some reason I decided to continue with this project and here we are.

Current state

  1. the repository was split into three by keeping the history (TYPO3SniffPoolTYPO3CMS and TYPO3Flow)
  2. they moved to github
  3. and was renamed to the new naming scheme

Finding a right naming scheme was the hardest task for me. It should express the purpose of every single standard - not too long and noticeable. It needs to be conformed to use it for class names, PEAR packages and Composer libraries and you don't get the impression that it means the product itself.

Ironically, I came to the conclusion to use the new naming scheme one to one and use typo3-ci as namespace when it's necessary.

  • PHPCS_TYPO3_SniffPool becomes TYPO3SniffPool
  • PHPCS_TYPO3v4_Standard becomes TYPO3CMS
  • PHPCS_FLOW3_Standard becomes TYPO3Flow

This renaming topic affects all users who installed the standard via PEAR. This is the most important change and you have to uninstall the old packages and install the new ones.

$ sudo pear uninstall typo3/PHPCS_FLOW3_Standard
$ sudo pear uninstall typo3/PHPCS_TYPO3v4_Standard
$ sudo pear uninstall typo3/PHPCS_TYPO3_SniffPool
$ sudo pear update-channels
$ sudo pear install typo3/TYPO3CMS
$ sudo pear install typo3/TYPO3Flow

If you cloned the standard via Git you have to get it now from our repository on github. The repository on forge.typo3.org will no longer be maintained.

$ sudo git clone --recursive https://github.com/typo3-ci/TYPO3_CodingStandard

You will get the stable version of the three standards.

We are not sure yet if we move completly to github. So for now the issue tracker is still on forge.typo3.org but we welcome every pull request on github.

What else happens

Inspire to share!

We offered Greg Sherwood, the author of the PHP_CodeSniffer, some of our sniffs from which we think they could be usefull for other projects. He agreed and Andy Grunwald did the most of the transaction work. Kudos to him :-)

Broken PEAR packages

Unfortunately, the PEAR packages were broken for TYPO3Flow (0.0.1, 0.0.2) and TYPO3CMS (0.0.4, 0.0.5), but I was able to fix the packages at least for TYPO3Flow 0.0.2 and TYPO3CMS 0.0.5.

Composer support

I am proud to announce that we support Composer now. All you have to do is to add a composer.json file to your project and declare the standard as an dependency. Have a look at the documentation.

Stay up-to-date

Follow @typo3_pear or @typo3_qa on twitter.


comments

comment #1
Gravatar: Philipp Gampe Philipp Gampe May 8, 2013 17:32
Of course you need to add "-beta", otherwise pear refuses to install non-stable packages.
$ sudo pear install typo3/TYPO3CMS-beta
$ sudo pear install typo3/TYPO3Flow-beta

IMHO the move to github is the wrong approach. You could easily create subprojects in redmine which hold a repository each. We do the same for documentation.

comment #2
Gravatar: Andreas Otto Andreas Otto May 9, 2013 17:26
Thanks for all the good work. You have done a great job.

I agree with Philip that the project might have better stayed on forge.typo3.org.

comment #3
Gravatar: Fabien Udriot Fabien Udriot May 10, 2013 08:40
I have been using your project and I am glad to see it moving forward. Thanks for the Composer integration.

comment #4
Gravatar: Sebastiaan van Parijs Sebastiaan van Parijs May 30, 2013 11:28
Thanks, this was very helpfull. We use both the PEAR and composer package.

Sorry, comments are closed for this post.