# Codecov ignores files at Kotlin source root

**URL:** <https://community.codecov.com/t/codecov-ignores-files-at-kotlin-source-root/925>\
**Category:** Bug Fixes\
**Created:** [January 24, 2020, 5:50pm UTC](https://community.codecov.com/t/codecov-ignores-files-at-kotlin-source-root/925 "2020-01-24T17:50:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![JamesOwenHall](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/jamesowenhall/32/498_2.png) [@JamesOwenHall](https://community.codecov.com/u/JamesOwenHall)\
**Post date:** [January 24, 2020, 5:50pm UTC](https://community.codecov.com/t/codecov-ignores-files-at-kotlin-source-root/925/1 "2020-01-24T17:50:52Z")

</div>

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.

Source: [https://kotlinlang.org/docs/reference/coding-conventions.html#directory-structure](https://kotlinlang.org/docs/reference/coding-conventions.html#directory-structure)

Codecov should include files at the source root to comply with the official conventions.

Has anyone run into this and figured out a workaround?

Thanks,  
James

---

<div class="post-metadata">

**Author:** ![drazisil](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/drazisil/32/496_2.png) [@drazisil](https://community.codecov.com/u/drazisil)\
**Post date:** [January 24, 2020, 6:59pm UTC](https://community.codecov.com/t/codecov-ignores-files-at-kotlin-source-root/925/2 "2020-01-24T18:59:49Z")

</div>

Hi @JamesOwenHall

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](https://docs.codecov.io/docs/fixing-paths) 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.

---

<div class="post-metadata">

**Author:** ![JamesOwenHall](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/jamesowenhall/32/498_2.png) [@JamesOwenHall](https://community.codecov.com/u/JamesOwenHall)\
**Post date:** [January 24, 2020, 7:26pm UTC](https://community.codecov.com/t/codecov-ignores-files-at-kotlin-source-root/925/3 "2020-01-24T19:26:41Z")

</div>

Hey @drazisil, thanks for the quick reply.  
I’ve tried using the `fixes` clause as described in the docs but to no avail. I’ll share what I’ve tried.

Our project is structured like this.

```auto
./my_subproject/src/main/kotlin
├── Config.kt
├── avro
│ └── AvroDeserializer.kt
// …

```

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`.

**codecov.yml**

```auto
fixes:
  - mysubproject/src/main/kotlin::src/main/kotlin/com/mycompany/mysubproject

```

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?

Thanks,  
James

---

<div class="post-metadata">

**Author:** ![drazisil](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/drazisil/32/496_2.png) [@drazisil](https://community.codecov.com/u/drazisil)\
**Post date:** [January 28, 2020, 2:52pm UTC](https://community.codecov.com/t/codecov-ignores-files-at-kotlin-source-root/925/4 "2020-01-28T14:52:18Z")

</div>

Try flipping the order in the fixes line.

(Makes the docs clearer is on my backlog)

---

<div class="post-metadata">

**Author:** ![JavierSegoviaCordoba](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/javiersegoviacordoba/32/1624_2.png) [@JavierSegoviaCordoba](https://community.codecov.com/u/JavierSegoviaCordoba)\
**Post date:** [March 7, 2021, 1:06pm UTC](https://community.codecov.com/t/codecov-ignores-files-at-kotlin-source-root/925/5 "2021-03-07T13:06:18Z")

</div>

Can this be fixed automatically by codecov?

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:

```auto
fixes:
  - module-one/src/commonMain/kotlin/com/javiersc/moduleOne::module-one/src/commonMain/kotlin
  - module-one/src/jvmMain/kotlin/com/javiersc/moduleOne::module-one/src/jvmMain/kotlin
  - ...
  - module-two/src/commonMain/kotlin/com/javiersc/moduleTwo::module-two/src/commonMain/kotlin
  - module-two/src/jvmMain/kotlin/com/javiersc/moduleTwo::module-two/src/jvmMain/kotlin
  - ...

```

---

<div class="post-metadata">

**Author:** ![JavierSegoviaCordoba](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/javiersegoviacordoba/32/1624_2.png) [@JavierSegoviaCordoba](https://community.codecov.com/u/JavierSegoviaCordoba)\
**Post date:** [March 7, 2021, 3:08pm UTC](https://community.codecov.com/t/codecov-ignores-files-at-kotlin-source-root/925/6 "2021-03-07T15:08:58Z")

</div>

I am trying to fix this problem manually, but even adding the codecov.yml file I can’t get it working.

This generic error doesn’t help a lot. How can I know what I am doing wrong?

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/2X/7/710b99cc616b41c1232d577df00e6f70e33b6c9f.png)

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [March 9, 2021, 1:18am UTC](https://community.codecov.com/t/codecov-ignores-files-at-kotlin-source-root/925/7 "2021-03-09T01:18:12Z")

</div>

@JavierSegoviaCordoba, can you please open a new ticket for this?
