Sonar Scanner 4.3.1.3277 ignoring Project Properties

Okay, thanks for the reproducer. I managed to reproduce the issue and it took me some time to investigate what could have affected it.

Actually, the property is handled correctly during both the configuration and execution phases. And there were no changes in the scanner, that could have affected that behavior.

After some bisecting, I’ve found out the root cause. Recently, we introduced the rules for gradle.kts files. In our Kotlin analyzer. To make this possible through Gradle, we started adding these files into sonar.sources property.

In your case, the exception happens during the attempt to add a build file. Before we can access it, Gradle invokes co.uzzu.dotenv.gradle plugin, but from there your .dotenv property is not visible, so it falls back to default and throws an exception.

I’m not completely sure whether we should rethink carefully the phases and allow co.uzzu.dotenv.gradle plugin resolve everything correctly, or simply ignore files if we can’t resolve them.

I’ve created a ticket, so we will discuss in the squad, how to better approach the issue:

https://sonarsource.atlassian.net/browse/SONARGRADL-131

Best,
Margarita

1 Like