Skip to content
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

Partial fixes for errors and warnings reported by ./gradlew lint #5885

Merged
merged 108 commits into from
Oct 27, 2024

Conversation

baijun6
Copy link
Contributor

@baijun6 baijun6 commented Oct 23, 2024

Description (required)

Fixes #5834

What changes did you make and why?
I have made the following changes as suggested by gradle lint. Current error and warning is at 79 and 926.

  1. Langauge localisation fixes:
    Added need missing quantity tags for plurals for all languages using preexisting translations in the file. Removed not needed
    quantity tags. Changes . . . to ... and ignored ImpliedQuantity warning for lines that are correct and didn't use %1$d. Fixes
    typos and some spelling errors.

  2. Fixes for warning with getColumnIndex() returning -1:
    Added ignore tag as returning -1 is expected behaviour to indicate there is no index.

  3. Fixes for android:tint, margin, redundant and invalid layout lines in XML files:
    Changes android:tint to app:tint, change marginLeft and Right to start and end to better support language layouts on
    different sides. Removed instances of the same layout using Left and Start and or Right and End as they do the same thing.
    Added focusable attribute to clickable attribute so they are accessible via keyboard. Removed redundant lines are they have
    no effect on the code and layout

  4. Changed getView(), getActivity() and argument!!:
    Changed the above to requireViews(), requireActivity() and requireArgument() as suggested by lint since they are throw
    exception on null.

  5. Added Locale.ROOT to toUppercase() and toLowerCase:
    Adding Localte.ROOT ensures that strings visible only to the code are always same as project and won't change due to
    device language locale changes.

  6. Miscellaneous fixes:
    Removed lint highlighted unneeded cast, unneeded safe assertions, unreachable code and code that always returns false to
    improve code quality.

Tests performed (required)

Tested on BetaDebug and ProdDebug with Pixel 9 and API 34.

Screenshots (for UI changes only)
Screenshot_20241024_015239
Screenshot_20241024_015315
Screenshot_20241024_015335
Screenshot_20241024_015345
Screenshot_20241024_015356

…!) on a non-null receiver of type DescriptionEditHelper
…gnoredOnParcel' annotation to remove the warning
… non-null receiver of type ZoomableDraweeView
baijun6 and others added 25 commits October 23, 2024 23:54
…ged layout_alignParentRight to layout_alignParentEnd
…dded focusable, changed margin layout and removed not needed and invalid params
…, changed margin layout and removed not needed and invalid params
…e, changed margin layout and removed not needed and invalid params
…le, changed margin layout and removed not needed and invalid params
…ble, changed margin layout and removed not needed and invalid params
Copy link
Member

@nicolas-raoul nicolas-raoul left a comment

Choose a reason for hiding this comment

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

Thanks! :-)

@nicolas-raoul nicolas-raoul merged commit 522f1fe into commons-app:main Oct 27, 2024
1 check failed
sivaraam pushed a commit that referenced this pull request Oct 28, 2024
* BaseMarker.kt: removed unneeded cast

* TransformImageImpl.kt: removed unreachable code

* ZoomableActivity.kt: removed Unnecessary safe call on a non-null receiver of type ZoomableDraweeView

* ZoomableActivity.kt: removed Unnecessary safe call on a non-null receiver of type ZoomableDraweeView

* DescriptionEditActivity.kt: removed unnecessary non-null assertion (!!) on a non-null receiver of type DescriptionEditHelper

* Media.kt: Property would not be serialized into a 'Parcel'. Added '@IgnoredOnParcel' annotation to remove the warning

* ZoomableActivity.kt: removed Unnecessary non-null assertion (!!) on a non-null receiver of type ZoomableDraweeView

* CategoryClient.kt: removed condition 'page.categoryInfo() == null' as it's always 'false'

* DescriptionEditActivity.kt: removed unnecessary safe call on a non-null receiver of type SessionManager

* DescriptionEditActivity.kt: removed unnecessary safe call on a non-null receiver of type DescriptionEditHelper

* WikidataFeedback.kt: removed unneeded cast

* FailedUploadsFragment.kt: removed unneeded non-null assertion (!!)

* PendingUploadsFragment.kt: removed unneeded non-null assertion (!!)

* AchievementsFragment.java: Changed toUpperCase to toUpperCase(Locale.getDefault())

* ExploreFragment.java: Changed toUpperCase to toUpperCase(Locale.getDefault())

* FileUtils.java: Changed toUpperCase to toUpperCase(Locale.getDefault())

* AchievementsFragment.java: Changed toUpperCase to toUpperCase(Locale.ROOT)

* ExploreFragment.java: Changed toUpperCase to toUpperCase(Locale.ROOT)

* LocationPickerActivity.java: Changed toUpperCase to toUpperCase(Locale.ROOT)

* MediaDetailFragment.java: Changed toUpperCase to toUpperCase(Locale.ROOT)

* NearbyFilterSearchRecyclerViewAdapter.java: Changed toUpperCase to toUpperCase(Locale.ROOT)

* ProfileActivity.java: Changed toUpperCase to toUpperCase(Locale.ROOT)

* RecentSearchesFragment.java: Changed toUpperCase to toUpperCase(Locale.ROOT)

* ReviewActivity.java: Changed toUpperCase to toUpperCase(Locale.ROOT)

* SearchActivity.java: Changed toUpperCase to toUpperCase(Locale.ROOT)

* UploadMediaPresenter.java: Changed toUpperCase to toLowerCase(Locale.ROOT)

* CategoriesMediaFragment.kt: Changed arguments!! to requireArguments()

* ChildDepictionsFragment.kt: Changed arguments!! to requireArguments()

* DepictedImagesFragment.kt: Changed arguments!! to requireArguments()

* DepictsFragment: Changed Objects.requireNonNull(getView()) to requireViews(), Objects.requireNonNull(getActivity())) to requireActivity()

* ParentCategoriesFragment.kt: Changed arguments!! to requireArguments()

* ParentCategoriesFragment.kt: Changed arguments!! to requireArguments()

* SubCategoriesFragment.kt: Changed arguments!! to requireArguments()

* SubCategoriesFragment.kt: Changed Objects.requireNonNull(getView()) to requireViews(), Objects.requireNonNull(getActivity()) to requireActivity()

* UploadMediaDetailFragment.java: Changed arguments!! to requireArguments()

* WikipediaInstructionsDialogFragment.kt: Changed arguments!! to requireArguments()

* BookmarkItemsDao.java: Added @SuppressLint("Range"), as -1 is expected behavior not index doesn't exist for getColumnIndex()

* BookmarkLocationsDao.java: Added @SuppressLint("Range"), as -1 is expected behavior not index doesn't exist for getColumnIndex()

* AndroidManifest.xml: Removed redundant label  android:label="@string/app_name"

* bs\strings.xml: Added missing few quantity

* hr\strings.xml: Added missing few quantity

* hr\strings.xml: Added missing zero, two, few, many quantities for lines 23 - 63

* Revert "hr\strings.xml: Added missing zero, two, few, many quantities for lines 23 - 63"

This reverts commit 4723246.

* cy\strings.xml: Added missing zero, two, few, many quantities for lines 23 - 63

* sr\strings.xml: Added missing few quantities for lines 35 to 70

* ro\strings.xml: Added missing few quantity and removed not needed zero for <plurals name="contributions_subtitle" fuzzy="true">

* cs\strings.xml: Added missing few many missing quantities for lines 33 - 74

* lt\strings.xml: Added missing few, many missing quantities for lines 34 - 58

* lt\strings.xml: Replaced . . . with ...

* ca\strings.xml: Added missing many quantities for lines 21 - 51, replaced . . . with ...

* ser\strings.xml: Added missing few quantities, replaced . . . with ...

* br\strings.xml: Added missing two, few, many quantities

* pt\strings.xml: Added missing many quantity, changed . . . to ... and ignored typo as it is correct for European Portuguese

* it\strings.xml: changed . . . to ...

* pt\strings.xml: fixed many quantity

* ca\strings.xml: fixed many quantity

* sr\strings.xml: fixed many quantity

* cy\strings.xml: corrected quantities for "share_license_summary

* fr\strings.xml: changed . . . to ... and add many quantities using the other quantity

* fr\strings.xml: changed . . . to ... and add many quantities using the other quantity. Fixed some typos, added ignore for correct spellings but has warning

* getColumnIndex(): added @SuppressLint("Range") as -1 is expected result for column name doesn't exist

* values-b+sr+Latn\strings.xml: changed . . . to ...

* Revert "values-b+sr+Latn\strings.xml: changed . . . to ..."

This reverts commit 95b909c.

* values-b+roa+tara\strings.xml: changed . . . to ...

* Revert "values-b+roa+tara\strings.xml: changed . . . to ..."

This reverts commit b5db1a3.

* values-b+roa+tara\strings.xml: changed . . . to ...

* values-b+sr+Latn\strings.xml: changed . . . to ..., add few based on other quantity. Ignored one ImpliedQuantity warning as it is correct.

* it\strings.xml: changed . . . to ..., add many based on other quantity.

* pt-rBR\strings.xml: changed . . . to ..., add many based on other quantity. Fixed typos, ignored warning for "one" quantity as translation didn't use number

* si\strings.xml: Ignored ImpliedQuantity warning as it uses 1 not %d. Removed not needed zero quantity

* si\strings.xml: Ignored ImpliedQuantity warning as it uses 1 not %d. Removed not needed zero quantity. Fixed wrong %1$d. Changed . . . to ...

* mk\strings.xml: changed . . . to ... and ignored ImpliedQuantity as it doesn't use 1

* sl\strings.xml: changed . . . to ... and ignored ImpliedQuantity as it doesn't use %1$d

* ru\strings.xml: changed . . . to ... and ignored ImpliedQuantity as it doesn't use %1$d

* uk\strings.xml: changed . . . to ... and ignored ImpliedQuantity as it doesn't use %1$d

* is\strings.xml: changed . . . to ... and ignored ImpliedQuantity as it doesn't use %1$d

* strings.xml: changed . . . to ...

* af\strings.xml: removed not needed zero quantity

* de\strings.xml: fixed duplicate word typo

* diq\strings.xml: changed - to dash (-)

* hi\strings.xml: removed not needed zero

* in\strings.xml: removed not needed one quantity

* iw\strings.xml: removed not needed many quantity

* ja\strings.xml: removed not needed one quantity

* ko\strings.xml: removed not needed one quantity

* ky\strings.xml: removed not needed one quantity

* mr\strings.xml: removed not needed zero quantity

* my\strings.xml: removed not needed one quantity

* su\strings.xml: removed not needed one quantity

* th\strings.xml: removed not needed one and zero quantity

* zh\strings.xml: removed not needed one quantity

* activity_description_edit.xml: changed android:tint to app:tint, changed layout_alignParentRight to layout_alignParentEnd

* bottom_sheet_details_explore.xml: changed android:tint to app:tint, added focusable, changed to margin layout

* bottom_sheet_item_layout.xml: changed android:tint to app:tint, added focusable

* bottom_sheet_details_explore.xml: changed android:tint to app:tint, added focusable, changed margin layout and removed not needed and invalid params

* item_place.xml.xml: changed android:tint to app:tint, added focusable, changed margin layout and removed not needed and invalid params

* layout_campagin.xml: changed android:tint to app:tint, added focusable, changed margin layout and removed not needed and invalid params

* layout_contribution.xml.xml: changed android:tint to app:tint

* nearby_card_view.xml: changed android:tint to app:tint, added focusable, changed margin layout and removed not needed and invalid params

* nearby_row_button.xml: changed android:tint to app:tint, added focusable, changed margin layout and removed not needed and invalid params

* toolbar_location_picker.xml: changed android:tint to app:tint

---------

Co-authored-by: Nicolas Raoul <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix errors found by ./gradlew lint
2 participants