qafoo / quality-analyzer
Helper for code reviews
Installs: 15 782
Dependents: 0
Suggesters: 0
Security: 0
Stars: 494
Watchers: 24
Forks: 31
Open Issues: 13
Language:JavaScript
Requires
- php: >=5.6
- ext-zip: *
- kore/data-object: ^1.1
- pdepend/pdepend: @stable
- phploc/phploc: ^2.1|^3.0
- phpmd/phpmd: @stable
- roave/security-advisories: dev-master
- sebastian/finder-facade: ^1.2
- sebastian/phpcpd: @stable
- squizlabs/php_codesniffer: @stable
- symfony/console: ^2.7|^3.0
Requires (Dev)
- phpunit/phpunit: ^5.6
- dev-master
- dev-greenkeeper-babel-core-6.7.5
- dev-greenkeeper-react-dom-15.0.0
- dev-greenkeeper-react-15.0.0
- dev-greenkeeper-phantomjs-2.1.7
- dev-greenkeeper-eslint-plugin-react-4.3.0
- dev-greenkeeper-jquery-2.2.3
- dev-greenkeeper-grunt-1.0.1
- dev-greenkeeper-grunt-1.0.0
- dev-greenkeeper-eslint-2.7.0
- dev-greenkeeper-grunt-cli-1.2.0
- dev-greenkeeper-eslint-2.6.0
- dev-greenkeeper-babel-eslint-6.0.2
- dev-greenkeeper-babel-eslint-6.0.1
- dev-greenkeeper-react-dom-0.14.8
- dev-greenkeeper-react-0.14.8
- dev-greenkeeper-eslint-2.5.3
- dev-greenkeeper-eslint-2.5.2
- dev-greenkeeper-babel-eslint-6.0.0
- dev-greenkeeper-babel-eslint-5.0.1
- dev-greenkeeper-eslint-2.5.1
- dev-greenkeeper-eslint-2.5.0
- dev-greenkeeper-style-loader-0.13.1
- dev-greenkeeper-jszip-2.6.0
- dev-greenkeeper-babel-core-6.7.4
- dev-greenkeeper-grunt-cli-1.1.0
- dev-greenkeeper-grunt-cli-1.0.1
- dev-greenkeeper-grunt-cli-1.0.0
- dev-greenkeeper-karma-junit-reporter-0.4.1
- dev-greenkeeper-grunt-karma-0.12.2
- dev-greenkeeper-jquery-2.2.2
- dev-greenkeeper-karma-jasmine-0.3.8
- dev-greenkeeper-eslint-plugin-react-4.2.3
- dev-greenkeeper-eslint-plugin-react-4.2.2
- dev-greenkeeper-grunt-contrib-watch-1.0.0
- dev-greenkeeper-sass-loader-3.2.0
- dev-greenkeeper-eslint-2.4.0
- dev-greenkeeper-babel-core-6.7.2
- dev-greenkeeper-karma-junit-reporter-0.4.0
- dev-greenkeeper-react-router-2.0.1
- dev-greenkeeper-babel-core-6.7.0
- dev-greenkeeper-eslint-plugin-react-4.2.1
- dev-greenkeeper-karma-0.13.22
- dev-greenkeeper-eslint-plugin-react-4.2.0
- dev-greenkeeper-eslint-2.3.0
- dev-greenkeeper-babel-core-6.6.5
- dev-greenkeeper-history-2.0.1
- dev-greenkeeper-babel-core-6.6.4
- dev-greenkeeper-babel-core-6.6.0
- dev-greenkeeper-babel-loader-6.2.4
- dev-greenkeeper-eslint-plugin-react-4.1.0
- dev-greenkeeper-webpack-1.12.14
- dev-greenkeeper-jquery-2.2.1
- dev-greenkeeper-eslint-plugin-react-4.0.0
- dev-greenkeeper-eslint-2.2.0
- dev-greenkeeper-d3-3.5.16
- dev-greenkeeper-babel-loader-6.2.3
- dev-greenkeeper-babel-eslint-5.0.0
- dev-greenkeeper-eslint-2.1.0
- dev-greenkeeper-grunt-eslint-18.0.0
- dev-greenkeeper-karma-0.13.21
- dev-greenkeeper-eslint-2.0.0
- dev-greenkeeper-babel-core-6.5.2
- dev-greenkeeper-karma-0.13.20
- dev-greenkeeper-d3-3.5.15
- dev-greenkeeper-grunt-eslint-17.3.2
- dev-greenkeeper-react-router-2.0.0
- dev-greenkeeper-babel-core-6.5.1
- dev-greenkeeper-babel-core-6.5.0
- dev-greenkeeper-eslint-plugin-standard-1.3.2
- dev-greenkeeper-eslint-config-standard-5.1.0
- dev-greenkeeper-eslint-config-standard-5.0.0
- dev-greenkeeper-react-router-v1.0.3
- dev-greenkeeper-history-2.0.0
- dev-greenkeeper-webpack-1.12.13
- dev-greenkeeper-babel-loader-6.2.2
- dev-greenkeeper-babel-eslint-4.1.8
- dev-greenkeeper-babel-eslint-4.1.7
- dev-greenkeeper-karma-jasmine-0.3.7
- dev-greenkeeper-node-sass-v3.4.2
- dev-greenkeeper-react-0.14.7
- dev-greenkeeper-react-dom-0.14.7
- dev-greenkeeper-karma-phantomjs-launcher-1.0.0
- dev-greenkeeper-phantomjs-2.1.3
- dev-greenkeeper-d3-3.5.14
- dev-greenkeeper-phantomjs-2.1.2
- dev-greenkeeper-phantomjs-2.1.1
- dev-greenkeeper-eslint-plugin-react-3.16.1
- dev-greenkeeper-eslint-plugin-react-3.16.0
- dev-greenkeeper-webpack-1.12.12
- dev-greenkeeper-d3-3.5.13
- dev-greenkeeper-babel-core-6.4.5
- dev-greenkeeper-xml2js-0.4.16
- dev-greenkeeper-eslint-plugin-react-3.15.0
- dev-greenkeeper-webpack-1.12.11
- dev-greenkeeper-jquery-2.2.0
- dev-greenkeeper-react-dom-0.14.6
- dev-greenkeeper-react-0.14.6
- dev-greenkeeper-babel-core-6.4.0
- dev-greenkeeper-webpack-1.12.10
- dev-greenkeeper-extract-text-webpack-plugin-1.0.1
- dev-greenkeeper-karma-0.13.19
- dev-greenkeeper-karma-0.13.18
- dev-greenkeeper-eslint-plugin-react-3.14.0
- dev-greenkeeper-karma-phantomjs-launcher-0.2.3
- dev-greenkeeper-babel-loader-6.2.1
- dev-greenkeeper-karma-0.13.17
- dev-greenkeeper-extract-text-webpack-plugin-1.0.0
- dev-greenkeeper-react-dom-0.14.5
- dev-greenkeeper-react-0.14.5
- dev-greenkeeper-react-0.14.4
- dev-greenkeeper-react-dom-0.14.4
- dev-greenkeeper-eslint-plugin-react-3.13.1
- dev-greenkeeper-karma-0.13.16
- dev-greenkeeper-karma-phantomjs-launcher-0.2.2
- dev-greenkeeper-eslint-plugin-react-3.13.0
- dev-greenkeeper-bootstrap-sass-loader-1.0.10
- dev-greenkeeper-react-router-1.0.3
- dev-greenkeeper-babel-core-6.3.26
- dev-greenkeeper-css-loader-0.23.1
- dev-greenkeeper-eslint-plugin-react-3.12.0
- dev-greenkeeper-history-1.17.0
- dev-greenkeeper-babel-core-6.3.21
- dev-greenkeeper-d3-3.5.12
- dev-greenkeeper-d3-3.5.11
- dev-greenkeeper-babel-core-6.3.17
- dev-greenkeeper-history-1.16.0
- dev-greenkeeper-react-router-1.0.2
- dev-greenkeeper-history-1.15.0
- dev-greenkeeper-history-1.14.0
- dev-greenkeeper-babel-core-6.3.15
- dev-greenkeeper-eslint-plugin-react-3.11.3
- dev-greenkeeper-react-router-1.0.1
- dev-greenkeeper-babel-core-6.3.13
- dev-greenkeeper-babel-core-6.3.2
- dev-greenkeeper-jasmine-core-2.4.1
- dev-greenkeeper-jasmine-2.4.1
This package is auto-updated.
Last update: 2024-12-04 18:28:00 UTC
README
This software is a tool to visualize metrics and source code. We use this software for Code Reviews together with our customers.
Running the analyzers requires the respective PHP tools, which are installed using composer and can all be run using a convenience command. You may also run the tools in your common build process, though.
To display the metrics a pure JavaScript / CSS stack is used so you could build and serve the results inside continuous integration tools like Jenkins. This might seem strange but it works really well even with software spanning 800,000 lines of PHP code.
If you want to improve, enhance the software or just fix some annoying bugs, you are very welcome to do so. The technology stack involved sadly is not that simple, though (PHP, Symfony2, Ant, Babel, D3, Grunt, Jasmine, Karma, SASS, PhantomJs, React, React-Router, Underscore, Webpack). A Code of Conduct applies for any interaction with this project – if you feel like it is violated get in contact with Kore.
Setup
To use the software there are very few steps involved. The only requirement is a current version of PHP.
Run the following commands to install the software:
git clone https://github.com/Qafoo/QualityAnalyzer.git cd QualityAnalyzer composer install
In the next step you can already analyze some software using something like this:
bin/analyze analyze src/php/
See "Usage" for more details on the command. The results of this command can be
found in the data/
folder.
Finally you can start the webserver to view the results:
bin/analyze serve
Click around and enjoy the data!
Usage
You start by analyzing a certain project or providing the tool with the paths to existing analyze files, like code coverage reports:
bin/analyze analyze /path/to/source
With the default command the tool will analyze the source code itself. For tools like PHPMD or PDepend this makes a lot of sense since the tool already knows which options to use for each tool.
There are some reports we cannot generate ourselves like code coverage from your tests. You can tell the tool where to find certain files to make sure they are available and ready to be used:
bin/analyze \ --coverage=/path/to/clover.xml \ --tests=/path/to/junit.xml \ analyze /path/to/source
You can also specify already generated files for all the other tools. But the visualization might behave strangely if some reports are generated in the wrong formats or some options are missing. We do not verify this (yet) properly.
To view the report in HTML format, run bin/analyze bundle /path/for/generated/html and then open /path/for/generated/html/index.html with your browser.
Ignore Sub-Directories
You might also want to tell the tools which directories there are to ignore by
the tools. This is especially important if you have (large) libraries in your
source directory – you do not want to analyze those. For this you may use the
--exclude
option:
bin/analyze \ --coverage=/path/to/clover.xml \ --tests=/path/to/junit.xml \ --exclude=libraries,vendor \ analyze /path/to/source
After the analyzer has finished use bin/analyze serve
or similar means to
access the index.html
with your browser and enjoy the results
visualization.
Exclude Analyzers
You might also to avoid some analyzers to be run on your code intentionally, e.g.
if you don't want your git usage be analysed. For this you may use the
--exclude_analyzers
option:
bin/analyze \ --exclude_analyzers=git,gitDetailed \ analyze /path/to/source
To get a list of all available analyzers, run:
bin/analyze list:analyzers
Customize Tools
If you want to customize tool execution you can always run all the tools
yourself and pass the existing result files to the analyze
command. An
example customizable ant build file doing this can be found here:
src/examples/customize.xml or src/examples/parallel.xml.
The parameters to pass you custom results, which wil omit running the tool by the analyzer command itself are:
--pdepend=PDEPEND Path to PDepend summary XML file --dependencies=DEPENDENCIES Path to PDepend dependencies XML file --phpmd=PHPMD Path to mess detector (PMD / PHPMD) XML file --checkstyle=CHECKSTYLE Path to checkstyle violations (PHP Code Sniffer) XML file --cpd=CPD Path to C&P violations (PHP Copy Paste Detector) XML file --phploc=PHPLOC Path to PHPLoc result XML file
Feel free to provide examples using different build environments by creating a pull request.
Building & Developing The Software
The build system of the Quality Analyzer is based on ant. You must have ant >= 1.8 installed. To be able to use it you should first initilaize the submodule containing the build commons:
git submodule update --init
To develop the Quality Analyzer we heavily depend on a JavaScript build stack. For this you must have node and npm installed. All other required tools will be installed by the build tool. To set the project into development mode run:
echo env=dev > environment.local
As long as you do not remove this line from the environment.local
file any
more or change it to prod
all development tools and libraries will be
installed and used. This also means JavaScript and CSS will be compiled by
commands like ant serve
.
Running The Tests
You can run the tests by executing ant
.
It will run run tests through Karma & Jasmine for parts of the JavaScript stack and PHPUnit tests for the PHP stack (once we have some).
Building CSS & JavaScript
The project uses ECMAScript 6 and transpiles it using Babel. Thus we need to update the bundle.js when working on the client. This is done when the project is prepared but can also be executed continuously using:
ant watch
This also compiles the SASS from the project and Bootstrap file into a single CSS file.
Trying Out The Project
If you want to try out the project you can serve the root directory with basically any webserver. The webserver should rewrite all requests to unknown resources to the index.html file which does the routing using JavaScript.
For your convenience we included a working server setup using PHPs internal webserver. You can start it using:
ant serve
Generating The Bundle Files
The following task ensures the bundle files are generated, compressed and comitted:
ant deploy
Use this command to update the distributed files.
It will run the package
task first (after running all tests, of course). If
there are changes in the assets/
folder those changes will be comitted and
the current development state will then be pushed.