Skip to content

How to write reports to file and summary to stdout? #1992

@jasonkarns

Description

@jasonkarns

I'm trying to set up a brakeman invocation on CI that writes to json and html, while also printing the text report to stdout.

However, a bunch of the options seem to have impact on other options.

The following prints summary in plain text but does not generate json or html reports to file.

    Brakeman::Commandline.run output_formats: [:json, :html],
      quiet: true, run_all_checks: true, summary_only: true

I tried the above with output_files: "tmp/brakeman" also, hoping to get the two reports written to tmp/brakeman/ directory, but no joy. (that generates an error)

So I explicitly listed both files (which seems redundant when you want them both in the same directory?).

    output_files = %w[tmp/brakeman/report.json tmp/brakeman/report.html]
    Brakeman::Commandline.run output_files:,
      quiet: true, run_all_checks: true, summary_only: true, print_report: true

This at least generates the report, but apparently the inclusion of output_files kills the print_report option? How do I get plain text summary to stdout while generating json and html files?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions