#1992·brakeman

How to write reports to file and summary to stdout?

Author: jasonkarnsCreated Jan 21, 2026Updated Jan 22, 2026

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?