-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Merge some of the WordPress lint rules, to reduce number of reported issues #21256
Conversation
Generated by 🚫 Danger |
Quality Gate passedIssues Measures |
📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
|
config/lint/lint.xml
Outdated
@@ -79,4 +79,6 @@ | |||
|
|||
<!-- TODO: https://github.com/wordpress-mobile/WordPress-Android/issues/21065 --> | |||
<issue id="UsingMaterialAndMaterial3Libraries" severity="warning" /> | |||
<!-- We rely on more granural checks from WordPress-Lint-Android --> | |||
<issue id="UnknownNullness" severity="ignore" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion (💡): Instead of ignoring UnknownNullness
I actually recommend we revert #19116 and remove all the configuration related to that, effectively removing it, not ignoring. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @ParaskP7 ! I've applied your suggestion and rebranded this PR to not introduce changed WordPress Lint checks. I don't have capacity to work on this now, but I think PR in this shape will also be useful to merge!
This reverts commit e210382.
We have this covered via checks from WordPress-Lint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 @wzieba !
I have reviewed this PR as per the instructions, everything works as expected, good job! 🌟
I have left one suggestion (💡) for you to consider. I am going to approve this PR anyway, since none is blocking. I am NOT going to merge this PR yet to give you some time to apply any of my suggestions. However, feel free to ignore them and merge the PR yourself.
libs/login/build.gradle
Outdated
@@ -18,7 +18,6 @@ android { | |||
buildConfig true | |||
} | |||
lint { | |||
enable += 'UnknownNullness' | |||
disable 'UseTomlInstead' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion (💡): I understand that we could remove this here too, now that all dependencies within this module are migrated to version catalogs. And then get rid of the whole lint { ... }
block, just like you did for the rest of the modules.
PS: We could potentially do the same for the fluxc
module, but we would first need to migrate the below two dependencies to version catalogs (however, I am not sure about the IgnoreWithoutReason
):
api "com.goterl:lazysodium-android:5.0.2@aar"
api "net.java.dev.jna:jna:5.15.0@aar"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PS: We could potentially do the same for the fluxc module, but we would first need to migrate the below two dependencies to version catalogs
This is not easy to do though, because of the aar specification not working as intended. This is needed, because both of these dependencies offer both aar
and jar
and one of them even defaults to jar
. This seems to be a known issue at Gradle (gradle/gradle#21267) but not yet fixed.
But regarding the login
module, I agree, I'll fix this in a sec!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But regarding the login module, I agree, I'll fix this in a sec!
Thanks @wzieba ! 🙏
This seems to be a known issue at Gradle (gradle/gradle#21267) but not yet fixed.
Yea, true, I tried really quick myself and couldn't get it working (the right way), but I didn't thought this would be such a blocker, interesting, thanks for sharing this issue... 🤔
I guess, in the meanwhile, we could do the following, adding a TODO comment point to the issue you shared:
libs.version.toml
...
[versions]
terl-lazysodium-android = '5.0.2@aar'
jna = '5.15.0@aar'
...
[libraries]
terl-lazysodium-android = { module = "com.goterl:lazysodium-android", version.ref = "terl-lazysodium-android" }
jna = { module = "net.java.dev.jna:jna", version.ref = "jna" }
...
build.gradle
api(libs.terl.lazysodium.android.get().toString()) // TODO: https://github.com/gradle/gradle/issues/21267
api(libs.jna.get().toString()) // TODO: https://github.com/gradle/gradle/issues/21267
Wdyt? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks neat, but I'm unable to verify that aar
instead of jar
is actually used.
Let's take the JNA dependency for the example: it offers both aar
and jar
. The default artifact specified in the pom file is jar
: https://mvnrepository.com/artifact/net.java.dev.jna/jna/5.15.0
When I applied your suggestion and when I run :WordPress:dependencyInsight --dependency net.java.dev.jna:jna --configuration wordpressWasabiDebugRuntimeClasspath
, it seems that jar
is used. You can compare this result to result of any other dependency, e.g. :WordPress:dependencyInsight --dependency androidx.credentials:credentials --configuration wordpressWasabiDebugRuntimeClasspath
which prints usage of aar
.
But what's strange, when I run the dependency insight for JNA on trunk
, I also see that jar
is requested 😕 .
For this reason, as I'm not entirely sure how it all work, I'd postpone changing this dependencies to version catalog as I'm not sure what would be the effect. Happy to hear your thoughts - maybe there's a way to make sure aar
is used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wzieba , I did a simple println(...)
to verify the exact string that is used. In the end, using this .get().toString()
trick should give us exactly what we had before, a simple string, there shouldn't be any more magic involved, not having version catalogs choosing between aar
and jar
whatsoever (🤔). This is my assumption at least. 🤞
println("LazySodium: ${libs.terl.lazysodium.android.get().toString()}")
println("JNA: ${libs.jna.get().toString()}")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha 👍 when I removed @aar
the project won't compile, and with the code you suggested, build is complete so I think we're all good 👍
I've also applied changed to remove IgnoreWithoutReason
from disabled rules.
Related discussion: #21256 (comment)
Suppress this warning on imported tests that are breaking this rule
Quality Gate passedIssues Measures |
Description
This PR disables
UnkownNullness
lint check, to not duplicate lint warnings of the same type we get from WordPress-Lint.Testing
Not necessary.
Related: wordpress-mobile/WordPress-Lint-Android#20