Sonar requires the coverage files to be provided during the project scanning. Those data files are generally recorded by plugins, servers, interpreters, ... when executing the tests.
This depends of the language and packager (like maven/gradle) used in the project to execute the tests and build the artifacts.
Here are some tips to setup that coverage per packager and language
For Maven
When using MAVEN, at least one pom.xml must be defined, the project contains normally a central pom.xml that is used to build the entire project (it can contain multiple maven sub-modules)
In this pom.xml, the sonar plugin must be defined
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.2</version>
</plugin>
Java
Javascript
Python
TBD