Skip to content

Commit b016c25

Browse files
committed
Create a docker image with a basic set of tools
1 parent 65c3148 commit b016c25

File tree

5 files changed

+132
-0
lines changed

5 files changed

+132
-0
lines changed

Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM php:7.1-cli
2+
3+
MAINTAINER Jakub Zalas <[email protected]>
4+
5+
ENV COMPOSER_ALLOW_SUPERUSER 1
6+
ENV BUILD_DEPS="autoconf file g++ gcc libc-dev make pkg-config re2c"
7+
ENV LIB_DEPS="zlib1g-dev"
8+
ENV TOOL_DEPS="git graphviz"
9+
ENV PATH="$PATH:/root/.composer/vendor/bin:/root/QualityAnalyzer/bin:/root/DesignPatternDetector/bin"
10+
11+
RUN apt-get update && apt-get install -y --no-install-recommends $TOOL_DEPS $BUILD_DEPS $LIB_DEPS && rm -rf /var/lib/apt/lists/* \
12+
&& docker-php-ext-install zip \
13+
&& echo "date.timezone=Europe/London" >> $PHP_INI_DIR/php.ini \
14+
&& echo "phar.readonly=0" >> $PHP_INI_DIR/php.ini \
15+
&& curl -Ls https://getcomposer.org/composer.phar > /usr/local/bin/composer && chmod +x /usr/local/bin/composer \
16+
&& curl -Ls https://box-project.github.io/box2/installer.php | php && mv box.phar /usr/local/bin/box && chmod +x /usr/local/bin/box \
17+
&& curl -Ls http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar > /usr/local/bin/php-cs-fixer && chmod +x /usr/local/bin/php-cs-fixer \
18+
&& curl -Ls https://github.com/phpmetrics/PhpMetrics/releases/download/v2.2.0/phpmetrics.phar > /usr/local/bin/phpmetrics && chmod +x /usr/local/bin/phpmetrics \
19+
&& curl -Ls https://github.com/phpstan/phpstan/releases/download/0.7/phpstan-0.7.phar > /usr/local/bin/phpstan && chmod +x /usr/local/bin/phpstan \
20+
&& curl -Ls https://phar.dephpend.com/dephpend.phar > /usr/local/bin/dephpend && chmod +x /usr/local/bin/dephpend \
21+
&& curl -Ls http://phpdoc.org/phpDocumentor.phar > /usr/local/bin/phpDocumentor && chmod +x /usr/local/bin/phpDocumentor \
22+
&& curl -Ls https://phar.phpunit.de/phpcpd.phar > /usr/local/bin/phpcpd && chmod +x /usr/local/bin/phpcpd \
23+
&& curl -Ls https://phar.phpunit.de/phploc.phar > /usr/local/bin/phploc && chmod +x /usr/local/bin/phploc \
24+
&& curl -Ls http://static.phpmd.org/php/latest/phpmd.phar > /usr/local/bin/phpmd && chmod +x /usr/local/bin/phpmd \
25+
&& curl -Ls http://static.pdepend.org/php/latest/pdepend.phar > /usr/local/bin/pdepend && chmod +x /usr/local/bin/pdepend \
26+
&& curl -Ls https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar > /usr/local/bin/phpcs && chmod +x /usr/local/bin/phpcs \
27+
&& curl -Ls https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar > /usr/local/bin/phpcbf && chmod +x /usr/local/bin/phpcbf \
28+
&& curl -Ls https://github.com/bytepark/php-phar-qatools/raw/master/phpcb.phar > /usr/local/bin/phpcb && chmod +x /usr/local/bin/phpcb \
29+
&& curl -Ls https://github.com/sensiolabs-de/deprecation-detector/releases/download/0.1.0-alpha4/deprecation-detector.phar > /usr/local/bin/deprecation-detector && chmod +x /usr/local/bin/deprecation-detector \
30+
&& composer global require --no-suggest --prefer-dist -n akeneo/php-coupling-detector edsonmedina/php_testability:dev-master \
31+
&& cd $HOME && git clone https://github.com/Qafoo/QualityAnalyzer.git && cd $HOME/QualityAnalyzer && composer install --no-dev --no-suggest --prefer-dist -n \
32+
&& cd $HOME && git clone https://github.com/Halleck45/DesignPatternDetector.git && cd $HOME/DesignPatternDetector && composer install --no-dev --no-suggest --prefer-dist -n \
33+
&& cd $HOME && git clone https://github.com/JakubOnderka/PHP-Parallel-Lint.git && cd $HOME/PHP-Parallel-Lint && composer install --no-dev --no-suggest --prefer-dist -n && box build && mv parallel-lint.phar /usr/local/bin/parallel-lint && chmod +x /usr/local/bin/parallel-lint && cd && rm -rf $HOME/PHP-Parallel-Lint \
34+
&& apt-get purge -y --auto-remove $BUILD_DEPS
35+
36+
ADD list-tools.sh /usr/local/bin/list-tools.sh
37+
CMD /usr/local/bin/list-tools.sh
38+

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2017 Jakub Zalas
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
default: build
2+
3+
build:
4+
docker build -t jakzal/phpqa .
5+
.PHONY: build
6+

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,46 @@
11
# Quality Analysis Tools for PHP
2+
3+
Docker image with quality analysis tools for PHP.
4+
5+
## Available tools
6+
7+
* composer - [Dependency Manager for PHP](https://getcomposer.org/)
8+
* box - [An application for building and managing Phars](https://box-project.github.io/box2/)
9+
* php-cs-fixer - [PHP Coding Standards Fixer](http://cs.sensiolabs.org/)
10+
* phpmetrics - [Static Analysis Tool](http://www.phpmetrics.org/)
11+
* phpstan - [Static Analysis Tool](https://github.com/phpstan/phpstan)
12+
* dephpend - [Detect flaws in your architecture](https://dephpend.com/)
13+
* phpDocumentor - [Documentation generator](https://www.phpdoc.org/)
14+
* phpcpd - [Copy/Paste Detector](https://github.com/sebastianbergmann/phpcpd)
15+
* phploc - [A tool for quickly measuring the size of a PHP project](https://github.com/sebastianbergmann/phploc)
16+
* phpmd - [A tool for finding problems in PHP code](https://phpmd.org/)
17+
* pdepend - [Static Analysis Tool](https://pdepend.org/)
18+
* phpcs - [Detects coding standard violations](https://github.com/squizlabs/PHP_CodeSniffer)
19+
* phpcbf - [Automatically corrects coding standard violations](https://github.com/squizlabs/PHP_CodeSniffer)
20+
* phpcb - PHP Code Browser - https://github.com/mayflower/PHP_CodeBrowser
21+
* deprecation-d[etector](Finds usages of deprecated code - https://github.com/sensiolabs-de/deprecation-detector)
22+
* php-coupling-detector - [Detects code coupling issues](https://akeneo.github.io/php-coupling-detector/)
23+
* analyze - [Visualizes metrics and source code](https://github.com/Qafoo/QualityAnalyzer)
24+
* design-p[attern](Dettects design patterns - https://github.com/Halleck45/DesignPatternDetector)
25+
* parallel-l[int](Checks PHP file syntax - https://github.com/JakubOnderka/PHP-Parallel-Lint)
26+
27+
## Building the image
28+
29+
```bash
30+
make build
31+
```
32+
33+
## Running tools
34+
35+
The default command will list available tools:
36+
37+
```bash
38+
docker run -it --rm jakzal/phpqa
39+
```
40+
41+
To run the selected tool inside the container, you'll need to mount
42+
the project directory on the container:
43+
44+
```bash
45+
docker run -it --rm -v $(pwd):/project -w /project jakzal/phpqa phpstan analyse src
46+
```

list-tools.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
3+
cat << TOOLS
4+
Available tools:
5+
* composer - Dependency Manager for PHP - https://getcomposer.org/
6+
* box - An application for building and managing Phars - https://box-project.github.io/box2/
7+
* php-cs-fixer - PHP Coding Standards Fixer - http://cs.sensiolabs.org/
8+
* phpmetrics - Static Analysis Tool - http://www.phpmetrics.org/
9+
* phpstan - Static Analysis Tool - https://github.com/phpstan/phpstan
10+
* dephpend - Detect flaws in your architecture - https://dephpend.com/
11+
* phpDocumentor - Documentation generator - https://www.phpdoc.org/
12+
* phpcpd - Copy/Paste Detector - https://github.com/sebastianbergmann/phpcpd
13+
* phploc - A tool for quickly measuring the size of a PHP project - https://github.com/sebastianbergmann/phploc
14+
* phpmd - A tool for finding problems in PHP code - https://phpmd.org/
15+
* pdepend - Static Analysis Tool - https://pdepend.org/
16+
* phpcs - Detects coding standard violations - https://github.com/squizlabs/PHP_CodeSniffer
17+
* phpcbf - Automatically corrects coding standard violations - https://github.com/squizlabs/PHP_CodeSniffer
18+
* phpcb - PHP Code Browser - https://github.com/mayflower/PHP_CodeBrowser
19+
* deprecation-detector - Finds usages of deprecated code - https://github.com/sensiolabs-de/deprecation-detector
20+
* php-coupling-detector - Detects code coupling issues - https://akeneo.github.io/php-coupling-detector/
21+
* analyze - Visualizes metrics and source code - https://github.com/Qafoo/QualityAnalyzer
22+
* design-pattern - Dettects design patterns - https://github.com/Halleck45/DesignPatternDetector
23+
* parallel-lint - Checks PHP file syntax - https://github.com/JakubOnderka/PHP-Parallel-Lint
24+
TOOLS

0 commit comments

Comments
 (0)