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 command line 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
/ --report
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 --report rules_by_id,some_other_report path/to/file.robot
To enable all reports use --report all
.
- 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 E0901 (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: 11 WARNINGs, 4 ERRORs.
- class robocop.reports.ReturnStatusReport#
Report name:
return_status
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.JsonReport#
Report name:
json_report
Report that returns list of found issues in JSON format.
- 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"