This MR add sorting by priority when dumping the report file.
Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/3961.