scheb/tombstone-analyzer

Generates reports based on the logs from scheb/tombstone

0.3.0 2016-12-05 21:10 UTC

README

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version Total Downloads License

Report generation for the tombstones created with the scheb/tombstone library.

Dashboard view Code view

Installation

Install via composer

$ composer require scheb/tombstone-analyzer

Composer automatically creates an executable binary vendor/bin/tombstone.

Usage

Provide a YAML config file to the tombstone-analyzer. Providing the config file is optional, by default it looks for a file named tombstone.yml in the current working directory.

$ tombstone -c tombstone.yml

Configuration

Relative paths in the configuration file are resolved relative to the config file's location.

The tool uses symfony/finder to scan the source directory, so have a look at its documentation to understand filter options.

Minimum configuration:

source:
    directories:
        - src  
logs:
    directory: logs

All configuration options:

source:
    # Required, Where your source files are located (see finder's "in" option)
    directories:
        - src

    # Exclude patterns relative to the ones defined in "directories" (see finder's "exclude" option)
    excludes:
        - tests

    # Name pattern to be included (see finder's "name" option)
    names:
        - "*.php"

    # Name pattern to be excluded (see finder's "notName" option)
    notNames:
        - "*.js"

# Optional, the root directory is used to make paths from the scanned sources relative. This is important, if you made
# the paths in your logs relative to a root directory.
rootDir: root

# One of the logs providers must be set, either "directory" or "custom"
logs:

    # Use the log file provider. This is where log files from AnalyzerLogHandler are located.
    directory: logs
    
    # Use your own log provider. You have to configure the file and class name.
    # Has to implement Scheb\Tombstone\Analyzer\Log\LogReaderInterface
    custom:
        file: "srLogReaderInterfaceder.php"
        class: 'Scheb\Tombstone\Analyzer\TestApplication\Tombstone\LogProvider'

# Report generation options
report:
    php: report/tombstone-report.php  # Generate a PHP report dump here
    html: report   # Generate a HTML report here
    console: true  # Display report on the console (default: false)

Contribute

You're welcome to contribute to this library by creating a pull requests or feature request in the issues section. For pull requests, please follow these guidelines:

  • Symfony code style
  • PHP7.1 type hints for everything (including: return types, void, nullable types)
  • declare(strict_types=1) must be used
  • Please add/update test cases
  • Test methods should be named [method]_[scenario]_[expected result]

To run the test suite install the dependencies with composer install and then execute bin/phpunit.

Acknowledgments

The library is heavly inspired by Nestoria.com's implementation of the tombstone concept.

Thanks to Sebastian Bergmann for letting me re-use parts of his code and the template files.

License

This library is available under the MIT license.