[Compile Warnings As Errors] WordPress Module - Resolve Other Warnings#17293
[Compile Warnings As Errors] WordPress Module - Resolve Other Warnings#17293
Conversation
Warning Message: "This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API." Adding the '@OptIn(DelicateCoroutinesApi::class)' annotation for the 'retrieveCapability(...)' function is the recommended action to resolve this 'GlobalScope' warning.
The Kotlin stdlib related '@Suppress' annotation is preferable to the Java lang related '@SuppressWarnings' annotation, if not for anything, even just for consistency purposes. As such, the '@SuppressWarnings' is being replaced with '@Suppress' on all Kotlin classes, wherever it is found.
Warning Message: "Parameter 'xyz' is never used" Notice that for 'Event Bus' related functions this warning should be suppressed instead. This is because this is how the 'Event bus' mechanism works as it need the parameter to be present on a function, even if that parameter is unused.
Warning Message: "Parameter 'xyz' is never used, could be renamed to _" Renaming the parameter 'xyz' that is never used to '_' or removing it completely is the recommended action to resolve this kind of warnings.
Warning Message: "Variable 'xyz' is never used"
Warning Message: "Name shadowed: xyz" Renaming the shadowed and/or the shadowing 'xyz' name is the recommended action to resolve this kind of deprecated warnings.
Warning Message: "Parcelize annotations from package 'kotlinx.android.parcel' are deprecated. Change package to 'kotlinx.parcelize'"
Warning Message: "Variable 'cursor' initializer is redundant"
Warning Message: "There is more than one label with such a name in this scope"
Warning Message: "Condition 'xyz' is always 'xyz'"
Warning Message: "Unreachable code"
|
|||||||||||
| 💡 Scan this QR code with your Android phone to download and install the APK directly on it. | ||
| App | WordPress | |
| Build Flavor | Jalapeno | |
| Build Type | Debug | |
| Commit | 3060469 | |
|
|||||||||||
| 💡 Scan this QR code with your Android phone to download and install the APK directly on it. | ||
| App | Jetpack | |
| Build Flavor | Jalapeno | |
| Build Type | Debug | |
| Commit | 3060469 | |
zwarm
left a comment
There was a problem hiding this comment.
@ParaskP7 - I have taken the apps out for a spin. Nothing unusual, so 👍 . Thanks for including me a reviewer, it's been nice seeing the changes and helps me in the future. I left one question, non-PR related, so I'll be merging this PR.
🚢
| ): List<String> { | ||
| val contentDescriptions = mutableListOf<String>() | ||
| entries.forEachIndexed { index, bar -> | ||
| entries.forEachIndexed { _, bar -> |
There was a problem hiding this comment.
@ParaskP7 - all is good with the change you made ... just questioning why the use of forEachIndexed without actually using the index. 🤷 What am I missing? And I don't expect a change for this, it's not part of the PR.
There was a problem hiding this comment.
Ha, yea, you are right @zwarm, this could have further improved to become a plain entries.forEach { bar -> ... }, the indexed version is not needed as the index ends up becoming unused. I am seeing this entries.forEachIndexed { index, bar -> ... } being actually used within getBarChartEntryContentDescriptions(...) above, and as such, I think this was just a copy-pasting overside at that point to create the getLineChartEntryContentDescriptions(...) below, which this time didn't have any need for that.
There was a problem hiding this comment.
PS: I am going to fix that on my next PR. It would be just another refactoring commit on top of all the others commits! 🎉 Thanks for spotting it! 🙇 ❤️ 🌟
|
And again, thank you so much for reviewing, testing and merging this PR @zwarm, you are awesome! 🙇 ❤️ 🚀 |


Parent: #17173
Partially Closes: #17181
This PR resolves one part of all
Otherrelated warnings for theWordPressmodule, and in this part, (mainly) specific to the main source:Main Source (
35):1xThis is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.17xParameter 'xyz' is never used9xParameter 'xyz' is never used, could be renamed to _2xName shadowed: xyz1xParcelize annotations from package 'kotlinx.android.parcel' are deprecated. Change package to 'kotlinx.parcelize'1xVariable 'xyz' initializer is redundant1xThere is more than one label with such a name in this scope2xCondition 'xyz' is always 'xyz'1xUnreachable codeTest Source (
5)3xParameter 'xyz' is never used2xVariable 'xyz' is never usedWarnings Resolution List:
Warnings Suppression List:
Refactor List:
PS: @zwarm I added you as the main reviewer, that is, in addition to @wordpress-mobile/apps-infrastructure team itself, but randomly, since I want someone from the WordPress Android team to primarily sign-off on that change. 🥇
FYI: I am going to randomly add more of you in those PRs that will follow, just so you become more aware of this change and how close we are on enabling allWarningsAsErrors by default everywhere. 🎉
To test:
WordPressandJetpackapps, and see if they are both working as expected.Regression Notes
N/A
See
To testsection above.N/A
PR submission checklist:
RELEASE-NOTES.txtif necessary.