[BUG]: Code coverage reports last curly brace as uncovered in Kotlin code #5523
Labels
bug
End user-perceivable behaviors which are not desirable.
Impact: Medium
Moderate perceived user impact (non-blocking bugs and general improvements).
Work: Low
Solution is clear and broken into good-first-issue-sized chunks.
Describe the bug
When generating code coverage reports using the code coverage tool for the Oppia Android, the last curly brace of some Kotlin functions is incorrectly marked as uncovered.
This issue has been observed in files: CpuPerformanceSnapshotter.kt, CommandExecutorImpl.kt, and TodoOpenCheck.kt.
It was suggested that there could be two potential causes:
Steps To Reproduce
Code snippet from CpuPerformanceSnapshotter.kt:
@OptIn(ObsoleteCoroutinesApi::class) private fun createCommandQueueActor(): SendChannel<CommandMessage> { return coroutineScope.actor(capacity = Channel.UNLIMITED) { for (message in channel) { ... } - } }
Generate code coverage report for the file CpuPerformanceSnapshotter.kt:
bazel run //scripts:run_coverage -- $(pwd) domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceSnapshotter.kt
The generated report:
Similarly observed with
CommandExecutorImpl.kt
path: scripts/src/java/org/oppia/android/scripts/common/CommandExecutorImpl.kt
TodoOpenCheck.kt
path: scripts/src/java/org/oppia/android/scripts/todo/TodoOpenCheck.kt
Expected Behavior
The last curly brace should be marked as covered in the report if the function is fully executed in the tests.
Bazel Version
6.5.0
Additional context
Related issue: jacoco/jacoco#884
What device/emulator are you using?
No response
Which Android version is your device/emulator running?
No response
Which version of the Oppia Android app are you using?
No response
The text was updated successfully, but these errors were encountered: