Skip to content

[Lint Warnings] Source Sets: Debug, WordPress and Jetpack - Resolve All Warnings#18227

Merged
ovitrif merged 13 commits intotrunkfrom
analysis/resolve-debug-wordpress-jetpack-lint-warnings
Apr 7, 2023
Merged

[Lint Warnings] Source Sets: Debug, WordPress and Jetpack - Resolve All Warnings#18227
ovitrif merged 13 commits intotrunkfrom
analysis/resolve-debug-wordpress-jetpack-lint-warnings

Conversation

@ParaskP7
Copy link
Copy Markdown
Contributor

@ParaskP7 ParaskP7 commented Apr 3, 2023

Parent #18162
Closes #18192

This PR resolves all Lint related warnings for the Debug, WordPress and Jetpack source sets:


Reconfigure Lint (Ignore):

  1. Ignore locale folder lint warnings for jetpack.

Warnings Resolution List:

  1. Resolve manifest order lint warning for debug.
  2. Resolve intent filter unique data attributes jetpack warnings.
  3. Resolve modifier parameter lint warnings for jetpack.

Warnings Suppression List:

  1. Suppress scoped storage lint warning for debug.
  2. Suppress missing application icon lint warning for debug.
  3. Suppress exported content provider lint warning for wordpress.
  4. Suppress vector path lint warnings for wordpress/jetpack.
  5. Suppress missing application icon lint warning for jetpack.

Documentation List:

  1. Add missing todo for missing firebase instance token refresh.
  2. Remove unnecessary main section from lint baseline.

PS: @ovitrif I added you as the main reviewer, randomly, since I just wanted someone from the WordPress team to be aware of and sign-off on that change for WPAndroid. I also added the @wordpress-mobile/apps-infrastructure team, but this in done only for monitoring purposes, as such, I am not expecting any active review from that team. Thus, feel free to merge this PR if you deem so.


To test:

  • There is nothing much to test here.
  • Verifying that all the CI checks are successful should be enough.
  • However, if you want to be thorough about reviewing this change, you could quickly smoke test both, the WordPress and Jetpack apps, and see if they are both working as expected.

FYI: As far as I can tell, the only commit that might cause some behavior change might be this 1117296 commit. Thus, you might want to check this one out in a bit more detail/depth. Everything else shouldn't cause any trouble.


Regression Notes

  1. Potential unintended areas of impact

    • Potential breakage or misbehaviour of the Jetpack related <intent-filter> functionality on DeepLinkingIntentReceiverActivity and its android.intent.action.VIEW action (see 1117296 commit).
  2. What I did to test those areas of impact (or what existing automated tests I relied on)

    • See To test section above.
  3. What automated tests I added (or what prevented me from doing so)

    • N/A

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

ParaskP7 added 11 commits April 3, 2023 15:58
Warning Message: "WRITE_EXTERNAL_STORAGE no longer provides write access
when targeting Android 11+, even when using
'requestLegacyExternalStorage'"

Explanation: "Scoped storage is enforced on Android 10+
(or Android 11+ if using requestLegacyExternalStorage). In particular,
WRITE_EXTERNAL_STORAGE will no longer provide write access to all files;
it will provide the equivalent of READ_EXTERNAL_STORAGE instead."

------------------------------------------------------------------------

This warning is already addressed and will be fixed as part of the
ongoing Android 13 media permissions work (see PR below):

PR: #18183
Warning Message: "'<uses-permission>' tag appears after
'<application>' tag"

Explanation: "The <application> tag should appear after the elements
which declare which version you need, which features you need, which
libraries you need, and so on. In the past there have been subtle bugs
(such as themes not getting applied correctly) when the <application>
tag appears before some of these other elements, so it's best to order
your manifest in the logical dependency order."

------------------------------------------------------------------------

Reordering the '<application>' and moving it after the
'<uses-permission>' tags fixes this warning.
Warning Message: "You should set an icon for the application as whole
because there is no default. This attribute must be set as a reference
to a drawable resource containing the image
(for example @drawable/icon)."

------------------------------------------------------------------------

Suppress this warning for the 'debug' source set should be enough for
the time being.
Warning Message: "Exported content providers can provide access to
potentially sensitive data"

Explanation: "Content providers are exported by default and any
application on the system can potentially use them to read and write
data. If the content provider provides access to sensitive data, it
should be protected by specifying export=false in the manifest or by
protecting it with a permission that can be granted to other
applications."

------------------------------------------------------------------------

This exported content provider was added as part of
dc7ba56 in order to enable content
migration from WordPress to Jetpack. The migration is currently still
in-progress (ish) so suppressing this for the the time being and at
least until the migration is fully complete.
Warning Message: "Very long vector path (X characters), which is bad for
performance. Considering reducing precision, removing minor details or
rasterizing vector."

Explanation: "Using long vector paths is bad for performance. There are
several ways to make the pathData shorter:
* Using less precision
* Removing some minor details
* Using the Android Studio vector conversion tool
* Rasterizing the image (converting to PNG)"

------------------------------------------------------------------------

As per the suggestions above, there are several ways to make the
'pathData' shorter. But, this is either requiring some additional
design help/work and then some extra testing too.

As such, suppressing these warnings, and as closer to source (pathData)
as possible, should be enough for the time being.

Later on, per 'pathData' and specific set of vector designs, an engineer
could closely collaborate with a designer to start updating those with
newer designs, one-by-one, and then test for correctness before merging
that change.
Warning Messages:
- "The locale folder "'he'" should be called "'iw'" instead; see the
'java.util.Locale' documentation"
- "The locale folder "'id'" should be called "'in'" instead; see the
'java.util.Locale' documentation"

Explanation: "From the java.util.Locale documentation:
"Note that Java uses several deprecated two-letter codes. The Hebrew
("he") language code is rewritten as "iw", Indonesian ("id") as "in",
and Yiddish ("yi") as "ji". This rewriting happens even if you construct
your own Locale object, not just for instances returned by the various
lookup methods.

Because of this, if you add your localized resources in for example
values-he they will not be used, since the system will look for
values-iw instead.

To work around this, place your resources in a values folder using the
deprecated language code instead."

------------------------------------------------------------------------

This Lint warning is moved within lint config and removed from Lint's
baseline because in order to resolve this warning a similar release
management localization solution should be set-up for the Jetpack app,
just like it is already done on the WordPress app.

Related: Lint Warnings - Resolve 'LocaleFolder'
- #18226
Warning Message: "Consider splitting data tag into multiple tags with
individual attributes to avoid confusion"

Explanation: "<intent-filter> <data> tags should only declare a single
unique attribute (i.e. scheme OR host, but not both). This better
matches the runtime behavior of intent filters, as they combine all of
the declared data attributes into a single matcher which is allowed to
handle any combination across attribute types.

For example, the following two <intent-filter> declarations are the
same:

<intent-filter>
    <data android:scheme="http" android:host="example.com" />
    <data android:scheme="https" android:host="example.org" />
</intent-filter>

<intent-filter>
    <data android:scheme="http"/>
    <data android:scheme="https"/>
    <data android:host="example.com" />
    <data android:host="example.org" />
</intent-filter>

They both handle all of the following:
* http://example.com
* https://example.com
* http://example.org
* https://example.org

The second one better communicates the combining behavior and is clearer
to an external reader that one should not rely on the scheme/host being
self contained. It is not obvious in the first that http://example.org
is also matched, which can lead to confusion (or incorrect behavior)
with a more complex set of schemes/hosts.

Note that this does not apply to host + port, as those must be declared
in the same <data> tag and are only associated with each other."

------------------------------------------------------------------------

Splitting the data tags into one 'scheme' tag (for 'jetpack') and
multiple 'host' tags (for 'viewpost', 'stats', 'read', 'post',
'notifications' and 'home') with individual attributes fixes these
warnings.
Warning Message: "You should set an icon for the application as whole
because there is no default. This attribute must be set as a reference
to a drawable resource containing the image
(for example @drawable/icon)."

------------------------------------------------------------------------

Suppress this warning for the 'jetpack' source set should be enough for
the time being.
Warning Message: "Modifier parameter should be the first optional
parameter"

Explanation: "The first (or only) Modifier parameter in a Composable
function should follow the following rules:
- Be named modifier
- Have a type of Modifier
- Either have no default value, or have a default value of Modifier
- If optional, be the first optional parameter in the parameter list"

------------------------------------------------------------------------

Reordering the 'modifier' parameter and moving it to become the first
optional parameter on the 'RepeatingColumn' composable function fixes
this warning.
Since there is no longer any other source set related section left
within the 'baseline.xml' configuration file, removing the only one such
remaining 'main' source set section is preferred to make this
Lint baseline file more straightforward and completely auto-generated.
@ParaskP7 ParaskP7 added this to the Future milestone Apr 3, 2023
@ParaskP7 ParaskP7 requested review from a team and ovitrif April 3, 2023 14:50
@ParaskP7 ParaskP7 self-assigned this Apr 3, 2023
@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Apr 3, 2023

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr18227-16c22e4
Commit16c22e4
Direct Downloadjetpack-prototype-build-pr18227-16c22e4.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Apr 3, 2023

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr18227-16c22e4
Commit16c22e4
Direct Downloadwordpress-prototype-build-pr18227-16c22e4.apk
Note: Google Login is not supported on these builds.

Copy link
Copy Markdown
Contributor

@ovitrif ovitrif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this awesome cleanup work @ParaskP7 🙇🏻

I tested the functionality that might have been affected by commit 1117296 using my public codepen: WP Deep Links Helper. All links worked as expected in the JP app 🎉

I left a small np comment on composables params ordering, but feel free to ignore it if you don't 💯 agree, and :shipit: 🚀

@ParaskP7
Copy link
Copy Markdown
Contributor Author

ParaskP7 commented Apr 7, 2023

Thank you so much for the review and testing @ovitrif , you are awesome! 🙇 ❤️ 🚀

I tested the functionality that might have been affected by commit 1117296 using my public codepen: WP Deep Links Helper. All links worked as expected in the JP app 🎉

🎉 Thank YOU! 🙇 x 💯

@ovitrif ovitrif merged commit c02091c into trunk Apr 7, 2023
@ovitrif ovitrif deleted the analysis/resolve-debug-wordpress-jetpack-lint-warnings branch April 7, 2023 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lint Warnings - Source Sets: Debug, WordPress and Jetpack [All]

3 participants