[TYPO3-50-general] Willing to help Task #1 Create sniffs for PHP Code Sniffer

Robert Lemke robert at typo3.org
Mon Dec 10 11:24:56 CET 2007


Hi Tim,

Am 09.12.2007 um 23:57 schrieb Tim Eilers:

> until now i am still a normal (end-)user of TYPO3 (running a few sites
> with 4.x). I am a bit experienced with normal php, but i never got
> really into the TYPO3 code...
> Now there is a little chance to give something back to the  
> community, so
> i decided to try to help.

That's great!

> I don't work in company, who works with TYPO3 (i do linux admin in the
> company i work in) and also don't an own one, so i do everything  
> dealing
> with TYPO3 as a hobby. usually the xmas time is full of everything, so
> don't expect me to be the fastest. After xmas i have holidays and free
> time, so then i could do the most of it.

Okay but please don't stress yourself. Promise us to not postpone any
nice holiday-activity just to sit at your computer and rack your brain
about our coding guidelines.

> Back to topic:
> I took a look at the coding guidelines and at PHP Code Sniffer. I  
> should
> say that i am an average PHP Coder, but never heard of the Sniffer or
> PHPUnit before. I took a look at the PHPUnit docs, but i don't really
> understand how PHPUnit could help in this task. ...and what the hell  
> is
> phing and how is it used in the 5.0 project? (the phing doc is really
> huge. i began to read it, but didn't understand even the first parts
> till now)
>
> I extracted "rules" out of the guidelines and tried to set a  
> priority to
> it. Some of them are never possible to check with Sniffer (take nouns
> for class names for example), some of them sound easy, but are  
> difficult
> to implement and some of them are very fast to implement.
> i experimented a bit and already implemented 'Class name start with  
> T3_'
> and 'Class name only content A-Za-z0-9 and _'.

Okay, let's take one step after another - we can split that project into
smaller tasks and some others might help you with that.

The idea of PHPUnit (or Unit Testing in general) is to create some  
automatic
testing for your (PHP-) code. It mainly serves two goals: 1) make sure  
that your
code works according to your assumptions and 2) document your  
assumptions.

You intuitively did already what is called Test Driven Development:  
You started
extracting the rules and then move on to coding.

I suggest that you do the following:

  - convert the coding guidelines we've written down so far into rules  
of this
    kind:

    "Class names of classes in the Classes/ directory must start with  
'T3_' followed
     by the package name"

    "All constants must be written uppercase, including 'TRUE' and  
'FALSE'"

    Best is, if you wrote all rules into our wiki - just fill this page:
    http://5-0.dev.typo3.org/trac/wiki/CodingStandards

  - Then you might want to categorize these rules

  - After that please let us know that you're done, because I'm pretty  
sure that we
    forgot to document quite some rules ...

  - If you really want to learn how to do Unit Testing / work with  
PHPUnit, you could
    start with reading the PHPUnit Pocket Guide (http://www.phpunit.de/pocket_guide/index.en.php 
).
    It's not exceptional verbose but it might give you a rough idea.
    Maybe Sebastian can help you a bit with the first steps.

    If you're not up to that, no problem either - we just ask  
someoneelse to work on
    that part.

And you don't have to care about PHING - we just use that to automize  
the execution
of certain tasks.

Thanks again for your help!
robert
-- 
http://typo3.org/gimmefive
http://buzz.typo3.org/people/robert-lemke/



More information about the TYPO3-project-5_0-general mailing list