BME-MIT-IET / ivt-ha-2024-pied-piper-1

ivt-ha-2024-pied-piper-1 created by GitHub Classroom
0 stars 0 forks source link

Static Analysis #1

Open JayWoodroffe opened 4 months ago

JayWoodroffe commented 4 months ago

Running a static analysis tool and reviewing the reported problems (SonarQube, FindBugs, VS Code Analyzer, Codacy, Coverity Scan...). As static analysis tools could find numerous problems, it is enough to review only a subset of them. If the team agrees with the reported problem, it can fix some of them. Try to review different types of problem and concentrate on more complex ones (e.g. not just formatting errors).

punketeee commented 4 months ago

I ran Lint as a static analysis tool. Some of the reported problems are obsolete layout params, overdrawing, long vector paths, hardcoded text, image without content description, query permissions needed. Can you check out the last 3?

JayWoodroffe commented 4 months ago

I ran Lint as a static analysis tool. Some of the reported problems are obsolete layout params, overdrawing, long vector paths, hardcoded text, image without content description, query permissions needed. Can you check out the last 3?

Absolutely. I can look through them tonight and summarise the issues I find by tomorrow morning.

punketeee commented 4 months ago

After a meeting, we have decided for my colleague to leave out image without content description error and instead focus on implied default locale in case conversion error.

List of errors we have reviewed:

Performance Issues:

Correctness Issues:

Internationalization Issues:

  1. Obsolete Layout Params image

In the file “activity_register_contact.xml”, there are many examples of using obsolete practices. While using LinearLayout, android:layout_below is utilized but this is incorrect: layout_below is only applicable in RelativeLayout.

  1. Overdraw image

In the file activity_apoointments.xml, overdraw is a repeating problem. Overdraw happens when a screen region is painted multiple times and it occurs when both the root layout and the theme apply the same background causing performance issues and unnecessary GPU usage.

  1. Long Vector Paths image

In ic_settings.xml, there is a 904 character long vector path. Vectors with such complex paths can impact app performance due to high processing needs. It can cause lag when drawing views or even app crashes if the vector drawing consumes too much memory or resources. Solution alternatives:

JayWoodroffe commented 4 months ago
  1. Using APIs affected by query permissions image

In ClientDetails.kt, an API that is affected by query permissions is used. Recent Android versions require apps to explicitly declare other apps or packages they intend to query using intents. Without a permission, intent resolutions might fail.

  1. Implied default locale in case conversion image

If toLowerCase() or toUpperCase() methods are used without specifying locale, the behavior can vary across devices due to different locales, thus leading to incorrect data handling, especially for languages other than English. This issue is present in AddClient.kt.

  1. Hardcoded text image

In documents such as activity_add_appointment.xml, activity_add_client.xml, activity_appointments.xml, etc. there is a recurring issue: the text strings in the layout are directly specified, which results in them not being translated and makes it difficult to localize the app for different regions.

punketeee commented 4 months ago

commit 53ed53b76fcf1d198eefdd9ad086fc1987650a49