Phpinsights: Enhancement for docker runs

Created on 2 Oct 2019  路  3Comments  路  Source: nunomaduro/phpinsights

| Q | A
| ---------------- | -----
| Bug report? | no
| Feature request? | yes
| Library version | 1.9.0

When running the command within my CI setup (docker run -it --rm -v $(pwd):/app nunomaduro/phpinsights), my wish to get the export done in json is not satisfied.

It'd be wise to facilitate integration (as it would also work locally), by providing the output formatting like :

return [
    "format" => [
          // "json" would default to "stdout", if no path provided.
          "json" => "/path/to/phpinsights/results.json" 
    ],
   ....
]

Like this, when running the docker command, the exports would be more useful in CI scripts (if anyone has an history of quality/tests results)

enhancement

Most helpful comment

@MrMadClown Great question, what if we split it up in two fields instead?

'format' => 'json',
'file' => '/path/to/phpinsights/results.json',

If file is not supplied, then it goes to console instead.

However this could also be opened up for custom outputters instead. So we have a console output and a file output that both implements the output interface.
This would open up for if a user wanted to send the config file directly to a third party service, they could just change the outputter to a custom one.

What do you guys think?

All 3 comments

Great idea, that makes a ton of sense to add support for specifying the format in the config.
This would however require two new features:

  • Add format in config file
  • Add support for directing output to file instead of stdout

If anybody wanna tackle this, then command argument should have higher priority than config file setting.

Would this be a valid Configuration?

return [
    "format" => [
          "checkstyle" => "/path/to/phpinsights/results.xml"
          "json" => "/path/to/phpinsights/results.json",
         "console"
    ],
   ....
]

What If I configure multiple Outputs to the same destination?

@MrMadClown Great question, what if we split it up in two fields instead?

'format' => 'json',
'file' => '/path/to/phpinsights/results.json',

If file is not supplied, then it goes to console instead.

However this could also be opened up for custom outputters instead. So we have a console output and a file output that both implements the output interface.
This would open up for if a user wanted to send the config file directly to a third party service, they could just change the outputter to a custom one.

What do you guys think?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sciracioglu picture sciracioglu  路  3Comments

szepeviktor picture szepeviktor  路  3Comments

nunomaduro picture nunomaduro  路  5Comments

erwinw picture erwinw  路  6Comments

dmitryuk picture dmitryuk  路  5Comments