Implement RuboCop rule Gitlab/NoCodeCoverageComment
What does this MR do and why?
This MR adds a Gitlab/NoCodeCoverageComment
to flag use of :nocov:
which excludes code from coverage report.
Current offenses were generated via rake rubocop:todo:generate[Gitlab/NoCodeCoverageComment]
.
Contributes to #368096 (closed).
Example offense
Offenses:
app/models/integration.rb:145:5: C: Gitlab/NoCodeCoverageComment: The use of :nocov: is discouraged. All code must have tests. See https://docs.gitlab.com/ee/development/contributing/merge_request_workflow.html#testing
# :nocov: Tested on subclasses.
^^^^^^^
app/models/integration.rb:160:5: C: Gitlab/NoCodeCoverageComment: The use of :nocov: is discouraged. All code must have tests. See https://docs.gitlab.com/ee/development/contributing/merge_request_workflow.html#testing
# :nocov:
^^^^^^^
How to set up and validate locally
bundle exec rake rubocop:todo:generate[Gitlab/NoCodeCoverageComment]
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Peter Leitzen