Skip to content

Mago Converter

carthage-software/mago - GitHub

Note

Available since version 1.6.0

Table Of Contents

  1. Requirements
  2. Installation
  3. Usage
  4. Learn more
  5. Web SARIF viewer

mago converter

Requirements

  • Mago requires PHP version 8.1 or greater.
{
    "require-dev": {
        "carthage-software/mago": "^1.25.2"
    }
}

Installation

composer require --dev carthage-software/mago bartlett/sarif-php-converters

Usage

Warning

As Mago 1.x is not able to specify/boot custom renderer easily, we have no other alternative that using the Console Tool convert command.

Build the gitlab output report

vendor/bin/mago lint /path/to/source --reporting-format gitlab > examples/mago/native.gitlab.json

And finally, convert it to SARIF with the Console Tool

php report-converter convert mago --input-format=gitlab --input-file=examples/mago/native.gitlab.json -v

Tip

  • Without verbose option (-v) the Console Tool will print a compact SARIF version.
  • --output-file option allows to write a copy of the report to a file. By default, the Console Tool will always print the specified report to the standard output.

Alternative :

vendor/bin/mago lint /path/to/source --reporting-format sarif > examples/mago/native.sarif.json
php report-converter convert mago --input-format=sarif --input-file=examples/mago/native.sarif.json -v > examples/mago/fixed-sarif.json

Learn more

Web SARIF viewer

With the React based component, you are able to explore a sarif report file previously generated.

For example:

sarif-web-mago