question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow specifying the output file name

See original GitHub issue

Describe the issue Hello, I was looking for a way to change the output filename when using the -o flag.

I can specify the path to save the file, but as per 2500 it appears that the path is only configurable and not the filename itself.

Additional context

The below output demonstrates the issue:

$ checkov -d . -o json --output-file-path ./checkov-keycloak-report.json
[-snip-]
2022-08-10 16:51:48,144 [MainThread  ] [ERROR]
An error occurred while writing json results to file: ./checkov-keycloak-report.json/results_json.json
Traceback (most recent call last):
  File "/usr/local/Cellar/checkov/2.1.60/libexec/lib/python3.10/site-packages/checkov/common/runners/runner_registry.py", line 102, in save_output_to_file
    with open(file_name, 'w') as f:
FileNotFoundError: [Errno 2] No such file or directory: './checkov-keycloak-report.json/results_json.json'

However, If I change --output-file-path . then it creates the file results_json.json. I want to change the filename locally from results_json.json to checkov-keycloak-report.json

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
Mikaciucommented, Sep 1, 2022

Hello,

I’m afraid the redirection does not export the report for the SARIF format

$ checkov --directory . --hard-fail-on MEDIUM --skip-check CKV_DOCKER_2 --output sarif > checkov.sarif
$ tail -n5 checkov.sarif
        File: /docker/Dockerfile:38-38
        Guide: https://docs.bridgecrew.io/docs/ensure-that-a-user-for-the-container-has-been-created


Wrote output in SARIF format to the file 'results.sarif'
0reactions
tspearconquestcommented, Oct 11, 2022

My apologies, I haven’t tested it yet, and was reviewing the code on my phone.

I’ll give this a try when I get some time and report back if I see any problems. Otherwise this can stay closed. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow specifying Output Filename in Run/Debug config ...
Envision I have a Content Sync Server with the commands download , import , export and upload . I would like to have...
Read more >
Specifying the Output File Name - NASM Manual
If the output file already exists, NASM will overwrite it, unless it has the same name as the input file, in which case...
Read more >
Allow specifying filename for jUnit XML · Issue #808 - GitHub
My use case is that I'm using Robo's ParallelExec command to run my Behat feature files in parallel, but because each output file...
Read more >
Allow to define output file name in command line mode
It would be very nice to be able specify output file name and location, instead of creating files with hardcoded names in the...
Read more >
How to let user choose output file name in writecsv
Try ?file.choose. That should bring up the window that lets you navigate to the folder you want, and enter the file name you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found