SLIDE 1 I n t e g r a t i n g P H P P r
e c t s w i t h J e n k i n s
S e b a s t i a n B e r g m a n n
O S C O N – J u l y 1 6
t h
2 1 2
SLIDE 2 s h a r i n g e x p e r i e n c e
S e b a s t i a n B e r g ma n n
» H
a s i n s t r u m e n t a l l y c
t r i b u t e d t
r a n f
m i n g P H P i n t
r e l i a b l e p l a t f
m f
l a r g e
c a l e , c r i t i c a l p r
e c t s .
» E
n t e r p r i s e s a n d P H P d e v e l
e r s a r
n d t h e w
l d b e n e f i t f r
t h e t
s t h a t h e h a s d e v e l
e d a n d t h e e x p e r i e n c e h e s h a r e s .
SLIDE 3
s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
SLIDE 4 s h a r i n g e x p e r i e n c e
C
t i n u
s I n t e g r a t i
„ S
t w a r e d e v e l
m e n t p r a c t i c e w h e r e m e m b e r s
a t e a m i n t e g r a t e t h e i r w
k f r e q u e n t l y , u s u a l l y e a c h p e r s
i n t e g r a t e s a t l e a s t d a i l y — l e a d i n g t
u l t i p l e i n t e g r a t i
s p e r d a y . E a c h i n t e g r a t i
i s v e r i f i e d b y a n a u t
a t e d b u i l d ( i n c l u d i n g t e s t ) t
e t e c t i n t e g r a t i
e r r
s a s q u i c k l y a s p
s i b l e . “
M a r t i n F
l e r
SLIDE 5 C
e T e s t S h i p
SLIDE 6 s h a r i n g e x p e r i e n c e
h t t p : / / e n . w i k i p e d i a .
g / w i k i / F i l e : D e v
s . p n g
SLIDE 7 s h a r i n g e x p e r i e n c e
R e l e a s e E a r l y , R e l e a s e O f t e n
„ O u r h i g h e s t p r i
i t y i s t
a t i s f y t h e c u s t
e r t h r
g h e a r l y a n d c
t i n u
s d e l i v e r y
v a l u a b l e s
t w a r e . “
A g i l e M a n i f e s t
SLIDE 8 s h a r i n g e x p e r i e n c e
R e l e a s e E a r l y , R e l e a s e O f t e n
„ S
t w a r e d e l i v e r s n
e v e n u e u n t i l i t i s i n t h e h a n d s
i t s u s e r s . [ …] F
l a r g e c
p a n i e s e v e r y w e e k
d e l a y b e t w e e n h a v i n g a n i d e a a n d r e l e a s i n g t h e c
e t h a t i m p l e m e n t s i t c a n r e p r e s e n t m i l l i
s
d
l a r s i n
p
t u n i t y c
t s [ …] “
J e z H u m b l e a n d D a v i d F a r l e y
SLIDE 9 I d e a C
e V a l u e
SLIDE 10 s h a r i n g e x p e r i e n c e
R e l e a s e E a r l y , R e l e a s e O f t e n
„ W e n e e d t
e t r i d
f t h e t e r m r e l e a s e c y c l e . “
S i m
S t e w a r t
SLIDE 11 s h a r i n g e x p e r i e n c e
R e l e a s e E a r l y , R e l e a s e O f t e n
h t t p : / / e n . w i k i p e d i a .
g / w i k i / F i l e : A g i l e
s
t e r a t i v e
l
. j p g
SLIDE 12 s h a r i n g e x p e r i e n c e
Q u a n t u m
D e p l
me n t
„ T h e s m a l l e s t n u m b e r
s t e p s , w i t h t h e s m a l l e s t n u m b e r
p e
l e a n d t h e s m a l l e s t a m
n t
c e r e m
y r e q u i r e d t
e t n e w c
e r u n n i n g
y
r s e r v e r s . “
h t t p : / / c
e a s c r a f t . e t s y . c
/ 2 1 / 5 / 2 / q u a n t u m
e p l
m e n t
SLIDE 13 s h a r i n g e x p e r i e n c e
C
t i n u
s D e l i v e r y
h t t p : / / e n . w i k i p e d i a .
g / w i k i / F i l e : C
t i n u
s _ D e l i v e r y _ p r
e s s _ d i a g r a m . p n g
SLIDE 14
SLIDE 15 s h a r i n g e x p e r i e n c e
( E l e me n t s
a ) P a t h t
t i n u
s D e l i v e r y
»C
e
» A
u t
a t e d T e s t s
» L
a t e n t C
e P a t t e r n s ( F e a t u r e F l a g s , . . . )
»S
t w a r e C
f i g u r a t i
M a n a g e m e n t
» F
e a t u r e B r a n c h e s
»A
u t
a t i
» B
u i l d
» D
e p l
m e n t
»C
t i n u
s I n t e g r a t i
SLIDE 16 s h a r i n g e x p e r i e n c e
»R
e d u c e r i s k s
»R
e d u c e r e p e t i t i v e p r
e s s e s
»P
r e v e n t l
i n t e r n a l s
t w a r e q u a l i t y
»G
e n e r a t e d e p l
a b l e s
t w a r e
»E
n a b l e b e t t e r p r
e c t v i s i b i l i t y
»E
s t a b l i s h g r e a t e r p r
e c t c
f i d e n c e
T h i s s l i d e c
t a i n s m a t e r i a l b y P a u l M . D u v a l l
C
t i n u
s I n t e g r a t i
SLIDE 17 s h a r i n g e x p e r i e n c e
»C
t i n u
s I n t e g r a t i
S e r v e r
»O
p e n S
r c e
»E
x t e n d a b l e
J e n k i n s
*
* h t t p : / / j e n k i n s
i .
g /
SLIDE 18
s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
I n s t a l l i n g J e n k i n s
mkdir /usr/local/jenkins cd /usr/local/jenkins wget http://mirrors.jenkins-ci.org/war-stable/latest/jenkins.war export JENKINS_HOME=/usr/local/jenkins java -jar jenkins.war
SLIDE 19 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
I n s t a l l i n g P l u g i n s f
J e n k i n s ( u s i n g J e n k i n s C L I )
wget http://localhost:8080/jnlpJars/jenkins-cli.jar java -jar jenkins-cli.jar -s http://localhost:8080 install-plugin \ checkstyle cloverphp dry htmlpublisher jdepend plot pmd violations \ xunit java -jar jenkins-cli.jar -s http://localhost:8080 safe-restart
SLIDE 20 s h a r i n g e x p e r i e n c e
B u i l d
„ A b u i l d a c t s a s t h e p r
e s s f
p u t t i n g s
r c e c
e t
e t h e r a n d v e r i f y i n g t h a t t h e s
t w a r e w
k s a s a c
e s i v e u n i t . “
P a u l M . D u v a l l
SLIDE 21 s h a r i n g e x p e r i e n c e
B u i l d A u t
t i
„ B u i l d a u t
a t i
i s t h e a c t
s c r i p t i n g
a u t
a t i n g a w i d e v a r i e t y
t a s k s t h a t s
t w a r e d e v e l
e r s d
n t h e i r d a y
a y a c t i v i t i e s i n c l u d i n g c
p i l i n g , p a c k a g i n g , r u n n i n g t e s t s , d e p l
m e n t t
r
u c t i
“
h t t p : / / e n . w i k i p e d i a .
g / w i k i / B u i l d _ A u t
a t i
SLIDE 22 s h a r i n g e x p e r i e n c e
Wh a t ' s i n a b u i l d ?
»C
e G e n e r a t i
/ C
e T r a n s f
m a t i
»(
C
p i l a t i
)
»A
u t
a t e d T e s t s
»C
e A n a l y s i s
»D
u m e n t a t i
G e n e r a t i
»P
a c k a g i n g / D e p l
m e n t
».
. .
SLIDE 23 s h a r i n g e x p e r i e n c e
C
e G e n e r a t i
/ C
e T r a n s f
ma t i
»A
u t
d e r
» P
H P A B
*
»O
b j e c t
e l a t i
a l M a p p e r
» M
e l P H P a n d S Q L c
e →
»F
r a m e w
k
» S
c a f f
d i n g
* h t t p : / / g i t h u b . c
/ t h e s e e r / A u t
d
SLIDE 24
s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
A p a c h e A n t
build.xml
S c r i p t
<project name="my-project" default="phpab"> <target name="phpab" description="Generate autoloader script"> <exec executable="phpab"> <arg value="--output" /> <arg path="${basedir}/src/autoload.php" /> <arg path="${basedir}/src" /> </exec> </target> </project>
SLIDE 25
s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
A p a c h e A n t
build.xml
S c r i p t
<project name="my-project" default="build"> <target name=“build" depends="phpab"/> <target name="phpab" description="Generate autoloader script"> <exec executable="phpab"> <arg value="--output" /> <arg path="${basedir}/src/autoload.php" /> <arg path="${basedir}/src" /> </exec> </target> </project>
SLIDE 26
s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
A p a c h e A n t
build.xml
S c r i p t
<project name="my-project" default="build"> <target name=“build" depends="prepare" /> <target name=“clean"> <!-- ... --> </target> <target name=“prepare" depends="clean,phpab"> <!-- ... --> </target> <target name="phpab" description="Generate autoloader script"> <exec executable="phpab"> <arg value="--output" /> <arg path="${basedir}/src/autoload.php" /> <arg path="${basedir}/src" /> </exec> </target> </project>
SLIDE 27 s h a r i n g e x p e r i e n c e
C
i l a t i
* h t t p : / / w w w . p h p . n e t / m a n u a l / e n / f e a t u r e s . c
m a n d l i n e .
t i
s . p h p
»C
p i l a t i
P H P c
e t
n a t i v e b i n a r y
» H
i p H
»S
y n t a x C h e c k
» php -l
*
SLIDE 28
s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
S y n t a x C h e c k
<project name="my-project" default="build"> <target name=“build" depends="prepare,lint" /> <!-- ... --> <target name="lint"> <apply executable="php" failonerror="true"> <arg value="-l" /> <fileset dir="${basedir}/src"> <include name="**/*.php" /> </fileset> <fileset dir="${basedir}/tests"> <include name="**/*.php" /> </fileset> </apply> </target> </project>
SLIDE 29
s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
S y n t a x C h e c k
<project name="my-project" default="build"> <target name=“build" depends="prepare,lint" /> <!-- ... --> <target name="lint"> <apply executable="php" failonerror="true"> <arg value="-l" /> <fileset dir="${basedir}/src"> <include name="**/*.php" /> <modified /> </fileset> <fileset dir="${basedir}/tests"> <include name="**/*.php" /> <modified /> </fileset> </apply> </target> </project>
SLIDE 30 s h a r i n g e x p e r i e n c e
P H P U n i t
*
»D
e
a c t
t a n d a r d f
u n i t t e s t i n g i n P H P
»L
f i l e s
» T
e s t R e s u l t s i n J U n i t X M L
» C
e C
e r a g e i n C l
e r X M L
* h t t p : / / p h p u n . i t /
SLIDE 31
s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P U n i t
<project name="my-project" default="build"> <target name=“build" depends="prepare,lint,phpunit" /> <target name=“clean"> <delete dir="${basedir}/build/coverage"/> <delete dir="${basedir}/build/logs"/> </target> <target name=“prepare" depends="clean,phpab"> <mkdir dir="${basedir}/build/coverage"/> <mkdir dir="${basedir}/build/logs"/> </target> <target name="phpunit" description="Run unit tests with PHPUnit"> <exec executable="phpunit" failonerror="true"/> </target> </project>
SLIDE 32
s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P U n i t
<phpunit bootstrap="src/autoload.php"> <testsuite name="my-project"> <directory suffix="Test.php">tests</directory> </testsuite> <logging> <log type="coverage-html" target="build/coverage" /> <log type="coverage-clover" target="build/logs/clover.xml" /> <log type="junit" target="build/logs/junit.xml" /> </logging> <filter> <whitelist addUncoveredFilesFromWhitelist="true"> <directory suffix=".php">src</directory> <exclude> <file>src/autoload.php</file> </exclude> </whitelist> </filter> </phpunit>
SLIDE 33 s h a r i n g e x p e r i e n c e
J e n k i n s P l u g i n : x U n i t
*
»„
T h i s p l u g i n m a k e s i t p
s i b l e t
u b l i s h t h e t e s t r e s u l t s
a n e x e c u t i
a t e s t i n g t
i n J e n k i n s “
»J
U n i t X M L i s n
r e a l l y s t a n d a r d i z e d
» P
H P U n i t u s e s n e s t e d
<testsuite>
e l e m e n t s
* h t t p : / / w i k i . j e n k i n s
i .
g / d i s p l a y / J E N K I N S / x U n i t + P l u g i n
SLIDE 34 s h a r i n g e x p e r i e n c e
J e n k i n s P l u g i n : C l
e r P H P
*
»„
T h i s p l u g i n a l l
s y
t
a p t u r e c
e c
e r a g e r e p
t s f r
P H P U n i t “
»O
n l y e x i s t s b e c a u s e t h e C l
e r p l u g i n h a s s
e q u i r k s a s i t e x p e c t s t h e r e a l C l
e r t
( f
J a v a ) t
e u s e d
* h t t p : / / w i k i . j e n k i n s
i .
g / d i s p l a y / J E N K I N S / C l
e r + P H P + P l u g i n
SLIDE 35
SLIDE 36 s h a r i n g e x p e r i e n c e
P H P L O C
*
»„
A t
f
q u i c k l y m e a s u r i n g t h e s i z e
a P H P p r
e c t “
»L
f i l e : C S V
* h t t p : / / g i t h u b . c
/ s e b a s t i a n b e r g m a n n / p h p l
SLIDE 37 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P L O C
Directories: 11 Files: 22 Lines of Code (LOC): 601 Cyclomatic Complexity / Lines of Code: 0.04 Comment Lines of Code (CLOC): 7 Non-Comment Lines of Code (NCLOC): 594 Namespaces: 11 Interfaces: 1 Traits: 0 Classes: 20 Abstract: 1 (5.00%) Concrete: 19 (95.00%) Average Class Length (NCLOC): 22 Methods: 38 Scope: Non-Static: 38 (100.00%) Static: 0 (0.00%) Visibility: Public: 26 (68.42%) Non-Public: 12 (31.58%) Average Method Length (NCLOC): 11 Cyclomatic Complexity / Number of Methods: 1.58 Anonymous Functions: 1 Functions: 0 Constants: 0 Global constants: 0 Class constants: 0
SLIDE 38
s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P L O C
<target name="phploc"> <exec executable="phploc"> <arg value="--log-csv" /> <arg value="${basedir}/build/logs/phploc.csv" /> <arg path="${basedir}/src" /> </exec> </target>
SLIDE 39 s h a r i n g e x p e r i e n c e
J e n k i n s P l u g i n : P l
*
»„
T h i s p l u g i n p r
i d e s g e n e r i c p l
t i n g (
g r a p h i n g ) c a p a b i l i t i e s i n J e n k i n s “
»U
s e d t
l
t h e m e t r i c s c
l e c t e d b y P H P L O C
e r t i m e
* h t t p : / / w i k i . j e n k i n s
i .
g / d i s p l a y / J E N K I N S / P l
+ P l u g i n
SLIDE 40 s h a r i n g e x p e r i e n c e
P H P _ C
e S n i f f e r
*
»„
T
e n i s e s P H P , J a v a S c r i p t a n d C S S f i l e s a n d d e t e c t s v i
a t i
s
a d e f i n e d s e t
c
i n g s t a n d a r d s “
»L
f i l e : C h e c k s t y l e X M L
* h t t p : / / p e a r . p h p . n e t / p a c k a g e / P H P _ C
e S n i f f e r
SLIDE 41 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P _ C
e S n i f f e r
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
- STANDARD CATEGORY SNIFF COUNT
- CodeRevi Functions Global function found 2297
CodeRevi PHP Global keyword not allowed 938 Generic PHP No silenced errors discouraged 523 CodeRevi PHP Forbidden functions found 77 Generic Code analysis For loop with test function call not allowe 53 Generic Code analysis Empty statement not allowed warning 34 Generic PHP Deprecated functions found 28 Generic Code analysis Useless overriding method found 4 Generic Classes Duplicate class name found 2 Generic Code analysis Unconditional if statement found 1
- A TOTAL OF 3957 SNIFF VIOLATION(S) WERE FOUND IN 10 SOURCE(S)
- Time: 08:02, Memory: 1750.25Mb
SLIDE 42 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P _ C
e S n i f f e r
FILE: /tmp/wordpress/wp-includes/admin-bar.php
- FOUND 7 ERROR(S) AND 16 WARNING(S) AFFECTING 23 LINE(S)
- 18 | WARNING | Consider refactoring "_wp_admin_bar_init" to avoid global
| | functions. 19 | ERROR | Use of the "global" keyword is forbidden 52 | WARNING | Consider refactoring "wp_admin_bar_render" to avoid global | | functions. 53 | ERROR | Use of the "global" keyword is forbidden 78 | WARNING | Consider refactoring "wp_admin_bar_my_account_menu" to avoid | | global functions. 79 | ERROR | Use of the "global" keyword is forbidden 101 | WARNING | Consider refactoring "wp_admin_bar_dashboard_view_site_menu" | | to avoid global functions. 119 | WARNING | Consider refactoring "wp_admin_bar_my_sites_menu" to avoid | | global functions. 120 | ERROR | Use of the "global" keyword is forbidden 154 | WARNING | Consider refactoring "wp_admin_bar_shortlink_menu" to avoid | | global functions. 176 | WARNING | Consider refactoring "wp_admin_bar_edit_menu" to avoid global | | functions. . . .
SLIDE 43 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P _ C
e S n i f f e r
<target name="phpcs"> <exec executable="phpcs" output="/dev/null"> <arg value="--report=checkstyle" /> <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" /> <arg value="--standard=${basedir}/build/phpcs.xml" /> <arg value="--ignore=autoload.php" /> <arg path="${basedir}/src" /> </exec> </target>
SLIDE 44 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P _ C
e S n i f f e r
<ruleset name="name-of-your-coding-standard"> <description>Description of your coding standard</description> <rule ref="Generic.PHP.DisallowShortOpenTag"/> <!-- ... --> </ruleset>
SLIDE 45 s h a r i n g e x p e r i e n c e
J e n k i n s P l u g i n : C h e c k s t y l e
*
»„
T h i s p l u g i n g e n e r a t e s t h e t r e n d r e p
t f
C h e c k s t y l e , a n
e n s
r c e s t a t i c c
e a n a l y s i s p r
r a m “
»U
s e d t
e p
t P H P _ C
e S n i f f e r r e s u l t s
* h t t p : / / w i k i . j e n k i n s
i .
g / d i s p l a y / J E N K I N S / C h e c k s t y l e + P l u g i n
SLIDE 46 s h a r i n g e x p e r i e n c e
P H P C
y / P a s t e D e t e c t
( P H P C P D )
*
»C
y / P a s t e D e t e c t
( C P D ) f
P H P c
e
»L
f i l e : P M D
P D X M L
* h t t p : / / g i t h u b . c
/ s e b a s t i a n b e r g m a n n / p h p c p d
SLIDE 47 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P C
y / P a s t e D e t e c t
( P H P C P D )
phpcpd 1.3.2 by Sebastian Bergmann. Found 26 exact clones with 459 duplicated lines in 4 files:
- wp-content/plugins/akismet/admin.php:488-500
wp-content/plugins/akismet/admin.php:537-549
- wp-content/plugins/akismet/legacy.php:234-248
wp-content/plugins/akismet/legacy.php:301-315 . .
- wp-includes/class-snoopy.php:165-172
wp-includes/class-snoopy.php:225-232
- wp-includes/class-snoopy.php:181-187
wp-includes/class-snoopy.php:339-345
- wp-includes/class-snoopy.php:317-331
wp-includes/class-snoopy.php:384-398 0.27% duplicated lines out of 171170 total lines of code. Time: 5 seconds, Memory: 73.25Mb
SLIDE 48 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P C
y / P a s t e D e t e c t
( P H P C P D )
<target name="phpcpd"> <exec executable="phpcpd"> <arg value="--log-pmd" /> <arg value="${basedir}/build/logs/pmd-cpd.xml" /> <arg path="${basedir}/src" /> </exec> </target>
SLIDE 49 s h a r i n g e x p e r i e n c e
J e n k i n s P l u g i n : D R Y
*
»„
T h i s p l u g i n g e n e r a t e s t h e t r e n d r e p
t f
d u p l i c a t e c
e c h e c k e r s l i k e C P D
S i m i a n “
»U
s e d t
e p
t P H P C P D r e s u l t s
* h t t p : / / w i k i . j e n k i n s
i .
g / d i s p l a y / J E N K I N S / D R Y + P l u g i n
SLIDE 50 s h a r i n g e x p e r i e n c e
P H P _ D e p e n d
*
»P
H P p
t
J D e p e n d
»L
f i l e : J D e p e n d X M L
»A
l s
S
t w a r e v i s u a l i z a t i
s
* h t t p : / / p d e p e n d .
g /
SLIDE 51 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P _ D e p e n d
pdepend --overview-pyramid=overview_pyramid.svg src PHP_Depend 1.0.7 by Manuel Pichler Parsing source files: ...................... 22 Executing Coupling-Analyzer: ..... 108 Executing CyclomaticComplexity-Analyzer: ..... 105 Executing Inheritance-Analyzer: . 36 Executing NodeCount-Analyzer: ... 70 Executing NodeLoc-Analyzer: .... 91 Generating pdepend log files, this may take a moment. Time: 00:01; Memory: 18.00Mb
SLIDE 52 s h a r i n g e x p e r i e n c e
P H P _ D e p e n d
A N D C A v e r a g e N u m b e r
D e r i v e d C l a s s e s A H H A v e r a g e H i e r a r c h y H e i g h t N O P N u m b e r
P a c k a g e s N O C N u m b e r
C l a s s e s N O M N u m b e r
M e t h
s L O C L i n e s
C
e ( n
m e n t , n
h i t e s p a c e ) C Y C L O C y c l
a t i c C
p l e x i t y C A L L S N u m b e r
O p e r a t i
C a l l s F A N O U T N u m b e r
C a l l e d C l a s s e s
SLIDE 53 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P _ D e p e n d
pdepend --jdepend-chart=abstraction_instability.svg src PHP_Depend 1.0.7 by Manuel Pichler Parsing source files: ...................... 22 Executing Dependency-Analyzer: ... 70 Generating pdepend log files, this may take a moment. Time: 00:00; Memory: 9.75Mb
SLIDE 54
s h a r i n g e x p e r i e n c e
P H P _ D e p e n d
SLIDE 55 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P _ D e p e n d
pdepend --jdepend-xml=jdepend.xml src PHP_Depend 1.0.7 by Manuel Pichler Parsing source files: ...................... 22 Executing Dependency-Analyzer: ... 70 Generating pdepend log files, this may take a moment. Time: 00:00; Memory: 9.75Mb dependencies.php jdepend.xml -o dependencies.svg
SLIDE 56
s h a r i n g e x p e r i e n c e
P H P _ D e p e n d
SLIDE 57 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P _ D e p e n d
pdepend --summary-xml=summary.xml src PHP_Depend 1.0.7 by Manuel Pichler Parsing source files: ...................... 22 Executing CyclomaticComplexity-Analyzer: ..... 105 Executing ClassLevel-Analyzer: .... 85 Executing CodeRank-Analyzer: . 32 Executing Cohesion-Analyzer: ....... 154 Executing Coupling-Analyzer: ..... 108 Executing Hierarchy-Analyzer: .... 87 Executing Inheritance-Analyzer: . 36 Executing NPathComplexity-Analyzer: ..... 105 Executing NodeCount-Analyzer: ... 70 Executing NodeLoc-Analyzer: .... 91 Generating pdepend log files, this may take a moment. Time: 00:00; Memory: 19.00Mb
SLIDE 58 s h a r i n g e x p e r i e n c e
C y c l
t i c C
l e x i t y
N u m b e r
p
s i b l e d e c i s i
p a t h s i n a p r
r a m
p r
r a m u n i t T h
a s J . M c C a b e , “ A C
p l e x i t y M e a s u r e , ” I E E E T r a n s a c t i
s
S
t w a r e E n g i n e e r i n g 2 , N
4 ( I E E E C
p u t e r S
i e t y P r e s s , L
A l a m i t
, C A , U S A , 1 9 7 6 ) .
SLIDE 59 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
C y c l
t i c C
l e x i t y
inspect.php summary.xml --metric0 ccn ================================================================= Name | Value ================================================================= BankAccountMapper::findById() | 4.0000 Router::route() | 4.0000 BankAccountController::execute() | 3.0000 Request::__call() | 3.0000 ControllerFactory::getController() | 3.0000 BankAccount::setBalance() | 2.0000 MapperFactory::getMapper() | 2.0000 BankAccountMapper::getAllIds() | 2.0000 BankAccountMapper::insert() | 2.0000 BankAccountMapper::delete() | 2.0000 BankAccountMapper::update() | 2.0000 BankAccountListView::render() | 2.0000 HashMap::get() | 2.0000 BankAccount::depositMoney() | 1.0000 . . .
SLIDE 60 s h a r i n g e x p e r i e n c e
N P a t h C
l e x i t y
N u m b e r
a c y c l i c e x e c u t i
p a t h s i n a p r
r a m
p r
r a m u n i t B r i a n A . N e j m e h , “ N P A T H : A M e a s u r e
E x e c u t i
P a t h C
p l e x i t y a n d i t s A p p l i c a t i
s ” , C
m u n i c a t i
s
t h e A C M 3 1 , I s s u e 2 ( F e b r u a r y 1 9 8 8 ) : 1 8 8 – 2 . I S S N 1
8 2 .
SLIDE 61 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
N P a t h C
l e x i t y
inspect.php summary.xml --metric0 npath ================================================================= Name | Value ================================================================= Router::route() | 8.0000 Request::__call() | 6.0000 BankAccountMapper::findById() | 6.0000 BankAccountController::execute() | 4.0000 ControllerFactory::getController() | 3.0000 BankAccountMapper::getAllIds() | 2.0000 BankAccountListView::render() | 2.0000 BankAccount::setBalance() | 2.0000 MapperFactory::getMapper() | 2.0000 BankAccountMapper::update() | 2.0000 BankAccountMapper::delete() | 2.0000 BankAccountMapper::insert() | 2.0000 HashMap::get() | 2.0000 BankAccount::withdrawMoney() | 1.0000 . . .
SLIDE 62
s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P _ D e p e n d
<target name="pdepend"> <exec executable="pdepend"> <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" /> <arg path="${basedir}/src" /> </exec> </target>
SLIDE 63 s h a r i n g e x p e r i e n c e
J e n k i n s P l u g i n : J D e p e n d
*
»„
T h e J D e p e n d P l u g i n i s a p l u g i n t
e n e r a t e J D e p e n d r e p
t s f
b u i l d s “
»U
s e d t
e p
t P H P _ D e p e n d r e s u l t s
* h t t p : / / w i k i . j e n k i n s
i .
g / d i s p l a y / J E N K I N S / J D e p e n d + P l u g i n
SLIDE 64 s h a r i n g e x p e r i e n c e
P H P M e s s D e t e c t
( P H P M D )
*
»„
[ P H P M D ] i s a s p i n
f p r
e c t
P H P _ D e p e n d a n d a i m s t
e a P H P e q u i v a l e n t
t h e w e l l k n
n J a v a t
P M D . P H P M D c a n b e s e e n a s a n u s e r f r i e n d l y a n d e a s y w a y t
f i g u r e f r
t e n d f
t h e r a w m e t r i c s m e a s u r e d b y P H P _ D e p e n d . “
»L
f i l e : P M D X M L
* h t t p : / / p h p m d .
g /
SLIDE 65 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P M e s s D e t e c t
( P H P M D )
<target name="phpmd"> <exec executable="phpmd"> <arg path="${basedir}/src" /> <arg value="xml" /> <arg value="${basedir}/build/phpmd.xml" /> <arg value="--reportfile" /> <arg value="${basedir}/build/logs/pmd.xml" /> </exec> </target>
SLIDE 66 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P M e s s D e t e c t
( P H P M D )
<ruleset name="name-of-your-coding-standard"> <description>Description of your coding standard</description> <rule ref="rulesets/codesize.xml/CyclomaticComplexity" /> <!-- ... --> </ruleset>
SLIDE 67 s h a r i n g e x p e r i e n c e
J e n k i n s P l u g i n : P M D
*
»„
T h i s p l u g i n g e n e r a t e s t h e t r e n d r e p
t f
P M D , a n
e n s
r c e s t a t i c c
e a n a l y s i s p r
r a m “
»U
s e d t
e p
t P H P M D r e s u l t s
* h t t p : / / w i k i . j e n k i n s
i .
g / d i s p l a y / J E N K I N S / P M D + P l u g i n
SLIDE 68 s h a r i n g e x p e r i e n c e
J e n k i n s P l u g i n : V i
a t i
s
*
»„
T h i s p l u g
n g e n e r a t e s r e p
t s s t a t i c c
e v i
a t i
d e t e c t
s s u c h a s c h e c k s t y l e , p m d , c p d , f i n d b u g s , c
e n a r c , f x c
, s t y l e c
a n d s i m i a n “
»U
s e d t
e p
t t h e r e s u l t s
» P
H P _ C
e S n i f f e r
» P
H P C
y / P a s t e D e t e c t
( P H P C P D )
» P
H P M e s s D e t e c t
( P H P M D )
* h t t p : / / w i k i . j e n k i n s
i .
g / d i s p l a y / J E N K I N S / V i
a t i
s
SLIDE 69 s h a r i n g e x p e r i e n c e
P H P _ C
e B r
s e r
*
»„
G e n e r a t e s a b r
s a b l e r e p r e s e n t a t i
P H P c
e w h e r e s e c t i
s w i t h v i
a t i
s f
n d b y q u a l i t y a s s u r a n c e t
s s u c h a s P H P _ C
e S n i f f e r
P H P M D a r e h i g h l i g h t e d “
* h t t p : / / g i t h u b . c
/ m a y f l
e r / P H P _ C
e B r
s e r
SLIDE 70 s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P _ C
e B r
s e r
<target name="phpcb"> <exec executable="phpcb"> <arg value="--log" /> <arg path="${basedir}/build/logs" /> <arg value="--source" /> <arg path="${basedir}/src" /> <arg value="--output" /> <arg path="${basedir}/build/code-browser" /> </exec> </target>
SLIDE 71 s h a r i n g e x p e r i e n c e
J e n k i n s P l u g i n : H T M L P u b l i s h e r
*
»„
T h i s p l u g i n p u b l i s h e s H T M L r e p
t s “
»A
P I D
u m e n t a t i
( f r
p h p d
, f
i n s t a n c e )
»O
u t p u t f r
P H P _ C
e B r
s e r
* h t t p : / / w i k i . j e n k i n s
i .
g / d i s p l a y / J E N K I N S / H T M L + P u b l i s h e r + P l u g i n
SLIDE 72
SLIDE 73 s h a r i n g e x p e r i e n c e
J e n k i n s P H P
*
»T
e m p l a t e f
A n t b u i l d s c r i p t s f
P H P p r
e c t s
»T
e m p l a t e f
J e n k i n s j
s f
P H P p r
e c t s
* h t t p : / / j e n k i n s
h p .
g /
SLIDE 74
SLIDE 75 s h a r i n g e x p e r i e n c e
D e p l
me n t
»A
r e t h e r e q u i r e d f e a t u r e s i m p l e m e n t e d ?
»D
i d t h e r e q u i r e d t e s t s p a s s ?
»A
r e t h e r e q u i r e d d e p e n d e n c i e s s a t i s f i e d ?
» V
e r s i
P H P
» P
H P E x t e n s i
s
» F
r a m e w
k a n d L i b r a r i e s
» D
a t a b a s e
» .
. .
SLIDE 76
s h a r i n g e x p e r i e n c e
P a c k a g e M a n a g e me n t
»P
E A R I n s t a l l e r
»P
H P A r c h i v e ( P H A R )
»O
S P a c k a g e M a n a g e r ( R P M , D E B , . . . )
SLIDE 77
s h a r i n g e x p e r i e n c e s h a r i n g e x p e r i e n c e
P H P A r c h i v e ( P H A R )
<target name="phar"> <exec executable="phpab"> <arg value="--phar" /> <arg value="--output" /> <arg path="${basedir}/build/bankaccount.phar" /> <arg path="${basedir}/src" /> </exec> </target>
SLIDE 78 s h a r i n g e x p e r i e n c e
R P M / D E B / . . . P a c k a g e s
»V
e r s i
r e q u i r e m e n t s ( m i n / m a x )
»D
e p e n d e n c i e s
h e r p a c k a g e s
»C
f i g u r a t i
»P
r e / P
t I n s t a l l a t i
S c r i p t s
SLIDE 79 s h a r i n g e x p e r i e n c e
R P M / D E B / . . . P a c k a g e s
»R
e p r
u c i b l e d e p l
m e n t
» R
e d e p l
a b l e
» R
e v e r s i b l e
»A
u t
a t a b l e
» S
i n g l e M a c h i n e
» M
u l t i p l e M a c h i n e s
SLIDE 80 s h a r i n g e x p e r i e n c e
A u t
t e d D e p l
me n t
»B
u i l d p a c k a g e
» C
t i n u
s I n t e g r a t i
S e r v e r
» M
a n u a l l y w h e n n e e d e d
»D
e p l
t
e s t / s t a g e s y s t e m ( s )
»A
d d t
r
u c t i
r e p
i t
y
SLIDE 81 s h a r i n g e x p e r i e n c e
A u t
t e d D e p l
me n t : P u s h v s . P u l l
»P
u s h u p d a t e s t
e r v e r ( s )
» O
n
e m a n d a c t i
w i t h f u l l c
t r
e r u p d a t e
» C
a n l e a d t
n c
s i s t e n t s e r v e r i n f r a s t r u c t u r e
»P
u l l u p d a t e s
s e r v e r ( s )
» U
p d a t e
l y p u s h e d t
e p l a c e ( r e p
i t
y )
» F
u l l y a u t
a t e d p r
e s s w h e r e t h e s e r v e r ( s ) a u t
a t i c a l l y p u l l ( s ) u p d a t e s
SLIDE 82 s h a r i n g e x p e r i e n c e
P u l l D e p l
me n t w i t h R H E L / C e n t O S / F e d
a
»Y
U M U p d a t e D a e m
» E
n a b l e a u t
a t i c d
n l
d
» E
n a b l e a u t
a t i c u p d a t e i n s t a l l a t i
»R
e d H a t N e t w
k S a t e l l i t e
SLIDE 83 s h a r i n g e x p e r i e n c e
P u l l D e p l
me n t i n G e n e r a l
»C
h e f
»P
u p p e t
».
. .
SLIDE 84 s h a r i n g e x p e r i e n c e
»W
e b h t t p : / / t h e P H P . c c / h t t p : / / S e b a s t i a n
e r g m a n n . d e /
»M
a i l s e b a s t i a n @ t h e P H P . c c
»T
w i t t e r @ S _ B e r g m a n n
»S
l i d e s h t t p : / / t a l k s . t h e P H P . c c /