# Test file inclusions seems to imply source exclusions

**URL:** <https://community.sonarsource.com/t/test-file-inclusions-seems-to-imply-source-exclusions/25430>\
**Category:** SonarQube Server / Community Build\
**Tags:** sonarqube\
**Created:** [May 28, 2020, 3:47pm UTC](https://community.sonarsource.com/t/test-file-inclusions-seems-to-imply-source-exclusions/25430 "2020-05-28T15:47:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KaibutsuX](https://avatars.discourse-cdn.com/v4/letter/k/a9a28c/32.png) [@KaibutsuX](https://community.sonarsource.com/u/KaibutsuX)\
**Post date:** [May 28, 2020, 3:47pm UTC](https://community.sonarsource.com/t/test-file-inclusions-seems-to-imply-source-exclusions/25430/1 "2020-05-28T15:47:56Z")

</div>

- SonarQube: 8.3.1.34397

All settings made in the UI

I have a project in which I want to scan all C source files and I also have gcov reports, but I only want to report on code coverage on the c sources in the src directory. My project level settings are:

- sonar.inclusions - \*\*/\*.c
- sonar.test.inclusions - src/\*.c

When scanning this project, then scanner reports the following information:

```auto
INFO: Project configuration:
INFO: Included sources: **/*.c
INFO: Excluded sources: src/*.c
INFO: Included tests: src/*.c
INFO: 75 files indexed
INFO: 1097 files ignored because of inclusion/exclusion patterns
INFO: 0 files ignored because of scm ignore settings

```

I have tried resetting the the UI parameters back to 0, adding/deleting no matter what, it seems that if I add src/\*.c to the test inclusions, the scanner detects that as a source exclusion even though the source.exclusions field is empty in the UI. I have checked that the global exclusions field is also empty.

What could possibly be related is that this project used to exist with god knows what settings, but I deleted the project and then re-added a new one with the same key. Is it possible the old key exists somewhere in the DB and wasn’t properly flushed?

I have restarted the sonar server and the issue still persists.

Is this a bug or am I just not understanding the behavior of sonar.test.inclusion?

---

<div class="post-metadata">

**Author:** ![Jeff\_Zapotoczny](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jeff_zapotoczny/32/2816_2.png) [@Jeff\_Zapotoczny](https://community.sonarsource.com/u/Jeff_Zapotoczny)\
**Post date:** [May 29, 2020, 8:23pm UTC](https://community.sonarsource.com/t/test-file-inclusions-seems-to-imply-source-exclusions/25430/2 "2020-05-29T20:23:28Z")

</div>

Hi KaibutsuX,

It’s more a misundertanding. `sonar.test.inclusions` will designate the matching files as _being_ tests. It sounds like the property you’re looking for is actually `sonar.coverage.exclusions` which can be used to identify project source files which you do not want to include in reported coverage results. There’s no `.inclusions` flavor of this property, so you’ll need to devise a pattern value that matches what you _don’t_ want. It may be as simple as `*.c` if it’s just C files in the top level folder you want to exclude.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![KaibutsuX](https://avatars.discourse-cdn.com/v4/letter/k/a9a28c/32.png) [@KaibutsuX](https://community.sonarsource.com/u/KaibutsuX)\
**Post date:** [June 1, 2020, 7:25pm UTC](https://community.sonarsource.com/t/test-file-inclusions-seems-to-imply-source-exclusions/25430/3 "2020-06-01T19:25:32Z")

</div>

oh that makes sense, thanks for the clarification!

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [June 8, 2020, 7:25pm UTC](https://community.sonarsource.com/t/test-file-inclusions-seems-to-imply-source-exclusions/25430/4 "2020-06-08T19:25:39Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
