-
-
Notifications
You must be signed in to change notification settings - Fork 755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.20.0 regression] Task detektMain does not exclude build directory anymore #4743
Comments
Do you mean 1.20.0? Or 0.20.0? |
Sorry it was a typo: I mean 1.20.0, the latest stable release. |
Is there a known workaround for this issue? How can I manually exclude the build folder from the |
Thanks for sharing your project. My gut feeling was that this would have worked:
Sadly this didn't worked for me. There seems to be some problems on how the source input is populated. The problem here is also that your project has a non trivial setup, so it's making harder to understand where the cause could. Having a minimal reproducer would help investigating. |
Ciao @cortinico, I've just pushed an update to the branch with the minimal reproducer that you asked for. Now there is only one empty Detekt still fails because it validates the generated code:
All the Detekt Gradle plugin config is here: https://github.com/leinardi/Forlago/blob/1a802fa1fce78fab1d918b033de5266768d09358/modules/core-network/build.gradle#L110 The YML config is still here: https://github.com/leinardi/Forlago/blob/detekt/config/detekt/detekt.yml Please let me know if I can help in some other way. |
Thanks for minimal reproduce. That helped me understantd what's going on. So I don't think this is a regression, but more like a side effect of how Detekt, AGP and Apollo interact each other (cc @martinbonnin for visibility). The "offending" change would be this one: We now populate the Detekt Source input using the
I believe the Apollo Gradle Plugin is populating the Kotiln source set in some form. On Detekt, we then allow users to exclude/include folders using the snippets I mentioned above. The current solution for you would be to either override the task source, so you won't get the autopopulated one:
or you can exclude a package path if it's well known and restricted to code-generation only (which btw it's a good practice).
Closing as there is nothing we can do on our end, unless we want to hardcode some known paths (i.e. |
Sorry for the late reply, it has been a busy week at work. Thank you for suggesting a couple of fixes, I went with the exclusion of the code generated package since I also that was the better solution. |
This seems to be a better way of doing this:
It filters build folder directly, so it is not dependent on specific package (for example, in our case, we had same package in both regular sources and generated source). I'm wondering though, why do some generators (such as Moshi and Anvil) get properly excluded out of the box, while others (such as Apollo or Sqldelight) do not? Do those generators register their sources in a different way? |
Expected Behavior
All the content of
.*/build/.*
should be automatically ignored by the taskdetektMain
.Observed Behavior
detektMain
is checking for violations inside the<module>/build/generated/
directory.Steps to Reproduce
detekt
branch: https://github.com/leinardi/Forlago/tree/detekt./gradlew detektMain
Context
detektMain
task but, so far, I did not find a way to do it.Your Environment
--scan
option when running the gradle task): https://gradle.com/s/b43326n7kjwgkThe text was updated successfully, but these errors were encountered: