July 15 Johannes Schmitt schmittjoh

Introducing Metrics Support

So far, scrutinizer has already provided you with condensed output in the form of comments, and auto-generated patches. As of now, it also gives you access to the raw metric data that is gathered for your project. You can use these metrics to spot some of the most problematic areas and prioritize refactoring efforts, and also a couple of cool features that are in the pipeline (see below).

Open Source Tools

As a start, we support metrics generated by open-source tools like php code coverage (top project risks, least tested methods), php lines of code (general size metrics), and pdepend (complexity, and coupling information). A typical build configuration for these tools looks like:

before_commands:
    - composer install --dev --prefer-source

tools:
    php_code_coverage: true
    php_pdepend:
        excluded_dirs: [vendor]
    php_loc:
        excluded_dirs: [vendor]

Custom Commands

Also, you can gather metrics for your own code. For example, scrutinizer benchmarks the serialization performance of jms/serializer on each code change. The benchmark script is located in the serializer repository and is then invoked as a custom command. On the website, this is shown as a nice column chart. The configuration looks like this:

before_commands:
    - composer install --dev --prefer-source

tools:
    custom_commands:
        -
            command: php tests/benchmark.php json 10 tests/benchmark.json
            scope: project
            output_file: tests/benchmark.json
            iterations: 5

Future Features

This also lays the foundation for some future features which will come shortly. One of these is statistical graphs which add a time dimension to all the gathered metrics and allow you to track development over time. The other feature is badges which will allow you to pose with your code coverage percentage for example :)

Stay tuned for these, and do not forget to enable the tools mentioned above so you can take full advantage of the upcoming features!

 

Have Feedback? Tweet to @scrutinizerci

If you experienced a bug or have any questions, please send them to [email protected].