In Kotlin projects, Codecov ignores all files directly under src/main/kotlin. It includes files in any subdirectory, such as src/main/kotlin/mydir/MyClass.kt, but ignores it if it’s src/main/kotlin/MyClass.kt.
Although Java projects include the full package name in the directory structure, the official Kotlin docs recommend not doing this.
In pure Kotlin projects, the recommended directory structure follows the package structure with the common root package omitted. For example, if all the code in the project is in the org.example.kotlin package and its subpackages, files with the org.example.kotlin package should be placed directly under the source root, and files in org.example.kotlin.network.socket should be in the network/socket subdirectory of the source root.
We include all files, the issue here is that the file path in the coverage report does not match the file path.
In this case, a path fix Path Fixing is needed to “move” the files in the report to their actual locations in the repo.
This has been confirmed working with at least one Kotlin repo, since it was private I can’t share an exact fix, but if you have trouble crafting it we will be happy to review what you have.
The reason I think this is actually a bug with Codecov is that all files under the avro subdirectory, as well as any other subdirectory, show up in the Codecov UI. This suggests that Codecov has no issues finding these files without using the fixes clause.
Only the top-level Config.kt file is being ignored by Codecov.
In any case, I did try using the fixes clause in the codecov.yml.
With this in my codecov.yml, the Codecov UI is updated to display all files other than Config.kt in src/main/kotlin/com/mycompany/mysubproject. Still the top-level Config.kt is ignored.
Do you think this is still a matter of mismatched paths? If so, why might all sub packages work?
If I have a multimodule project with 100 projects, I have to fix all of them, and if I add a new one, I have to remember to fix it too. Or I have to create an algorithm to generate this YAML file.
I can understand in strange situations we should manually fix things, but an official code convention should be covered automatically, IHMO.
And I have a Kotlin Multiplatform project, so I can have thousands of lines easily if I have a lot of sourceSets per project: