optittm / bugprediction

A CLI tool to assess the risk of releasing your next version. Can generate a comprehensive dataset for testing your bug prediction models.
MIT License
0 stars 1 forks source link

php-xml extension is required for PHPDepend. Update DOC and Dockerfile #38

Closed bbalet closed 1 year ago

bbalet commented 1 year ago

PHPDepend requires the use of DOM in order to output the XML report file.

Creadeyh commented 1 year ago

Please elaborate. I reinstalled my php to check and I don't have this requirement to use pdpend.phar

bbalet commented 1 year ago

Many linux distros (e.g. alpine for Docker, Ubuntu, etc.) install the strict minimum when you install the php-cli and the php-xml extension is available with antother package.

Look for example this try on a fresh Ubuntu install having only php-cli package installed:

bbalet@DESKTOP:~/projects/bugprediction$ /bin/php -d error_reporting='E_ALL & ~E_DEPRECATED' ./ext- 
tools/pdepend.phar --summary-xml=/tmp/tmpo025iyyp/summary.xml /tmp/tmpgscym0bp/guzzle
PHP Fatal error:  Uncaught RuntimeException: Extension DOM is required. in phar:///root/projects/bugprediction/ext-            
tools/pdepend.phar/vendor/symfony/config/Util/XmlUtils.php:45
Stack trace:
...

Then I've installed the missing extension:

bbalet@DESKTOP:~/projects/bugprediction$ apt-get install php-xml

And it is working like a charm:

bbalet@DESKTOP:~/projects/bugprediction$  /bin/php -d error_reporting='E_ALL & ~E_DEPRECATED' ./ext-        
tools/pdepend.phar --summary-xml=/tmp/tmpo025iyyp/summary.xml /tmp/tmpgscym0bp/guzzle
PDepend 2.12.1snapshot202209081939

Parsing source files:
............................................................    60
..............                                                  74

It makes me think that php-cli and php-xml must be installed into the Docker image along wito the JRE and I didn't see them in devel.

Bug prediction targets an install with Docker and is expected to work in a CI/CD pipeline so it is important to fix these two things.

See:

https://pkgs.alpinelinux.org/package/v3.3/main/x86/php-xml https://www.php.net/manual/en/dom.requirements.php