Reports#
Reports are configurable summaries after Robocop scan. For example, it can be a total number of issues discovered. They are dynamically loaded during setup according to a configuration.
Each report class collects rules messages from linter and parses it. At the end of the scan it will print the report.
To enable report use -r
/ --reports
argument and the name of the report.
You can use separate arguments (-r report1 -r report2
) or comma-separated list (-r report1,report2
). Example:
robocop --reports rules_by_id,some_other_report path/to/file.robot
To enable all default reports use --reports all
.
The order of the reports is preserved. For example, if you want timestamp
report to be printed before any
other reports, you can use following configuration:
robocop --reports timestamp,all src.robot
- class robocop.reports.RulesByIdReport#
Report name:
rules_by_id
Report that groups linter rules messages by rule id and prints it ordered by most common message. Example:
Issues by ID: W0502 (too-little-calls-in-keyword) : 5 W0201 (missing-doc-keyword) : 4 E0401 (parsing-error) : 3 W0301 (not-allowed-char-in-name) : 2 W0901 (keyword-after-return) : 1
- class robocop.reports.RulesBySeverityReport#
Report name:
rules_by_error_type
Report that groups linter rules messages by severity and prints total of issues per every severity level.
Example:
Found 15 issues: 4 ERRORs, 11 WARNINGs.
- class robocop.reports.ReturnStatusReport#
Report name:
return_status
This report is always enabled. Report that checks if number of returned rules messages for given severity value does not exceed preset threshold. That information is later used as a return status from Robocop.
- class robocop.reports.TimeTakenReport#
Report name:
scan_timer
Report that returns Robocop execution time
Example:
Scan finished in 0.054s.
- class robocop.reports.FileStatsReport#
Report name:
file_stats
Report that displays overall statistics about number of processed files.
Example:
Processed 7 files from which 5 files contained issues.
- class robocop.reports.RobocopVersionReport#
Report name:
version
Report that returns Robocop version.
Example:
Report generated by Robocop version: 2.0.2
- class robocop.reports.TimestampReport#
Report name:
timestamp
Report that returns Robocop execution timestamp. Timestamp follows local time in format of Year-Month-Day Hours(24-hour clock):Minutes:Seconds ±hh:mm UTC offset as default.
Example:
Reported: 2022-07-10 21:25:00 +0300
Both of default values,
timezone
andformat
can be configured by-c/--configure
andtimestamp:timezone:"<timezone name>"
and/ortimestamp:format:"<format string>"
:robocop --configure timestamp:timezone:"Europe/Paris" --configure timestamp:format:"%Y-%m-%d %H:%M:%S %Z %z"
This yields following timestamp report:
Reported: 2022-07-10 20:38:10 CEST +0200
For timezone names, see: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
For timestamp formats, see: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes
Useful configurations:
Local time to ISO 8601 format: robocop --configure timestamp:format:"%Y-%m-%dT%H:%M:%S%z" UTC time: robocop --configure timestamp:timezone:"UTC" --configure timestamp:format:"%Y-%m-%dT%H:%M:%S %Z %z" Timestamp with high precision: robocop --configure timestamp:format:"%Y-%m-%dT%H:%M:%S.%f %z" 12-hour clock: robocop --configure timestamp:format:"%Y-%m-%d %I:%M:%S %p %Z %z" More human readable format 'On 10 July 2022 07:26:24 +0300': robocop --configure timestamp:format:"On %d %B %Y %H:%M:%S %z"
- class robocop.reports.SarifReport#
Report name:
sarif
Report that generates SARIF output file.
This report is not included in the default reports. The
--reports all
option will not enable this report. You can still enable it using report name directly:--reports sarif
or--reports all,sarif
.All fields required by GitHub Code Scanning are supported. The output file will be generated in the current working directory with the
.sarif.json
name.You can configure output directory and report filename:
robocop --configure sarif:output_dir:C:/sarif_reports --configure sarif:report_filename:.sarif