Skip to content

gitlab-CI: Add ability to define a warning regex in the .gitlab-ci.yml in a similar fashion as current coverage

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem to solve

As a user that has a job that runs doxygen, I would like to report the number of warnings generated during job.

Further details

Assume you have a job that runs doxygen. Doxygen will output lines such as "/my/path:52: warning: Member m_depth (variable) ..."

I wish to count the number of warnings, and report them back in a similar fashion as coverage.

Proposal

html-doxygen:
  stage: build
  script:
    - make -C doc html-doxygen 2>&1 | (echo -n "TOTAL: " ; grep -c warning)
  warnings: '/(?m)^TOTAL.*\s+(\d+\%)$/'

What does success look like, and how can we measure that?

Success would have a line similar to "TOTAL: 2532" output during the job; which would be parsed in a similar fashion than the coverage regex.

Warnings (in our case 2532) would then be visible, in a coverage like fashion, via optional badge, and on pages such as https://gitlab.example.com/example/myproject/pipelines/3582/builds

Links / references

Related: https://gitlab.com/gitlab-org/gitlab-ce/issues/20428

Notes

  • Usage of coverage is currently always exposed and presented as a precentage; we can not fake this use case just by using coverage.
  • We could extend this to an errors keyword too.
  • My example is for doxygen, but can apply to gcc -Wall, etc...
Edited by 🤖 GitLab Bot 🤖