Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Checking jenkins to github commenter functionality for androidlint reports #735

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public void onClickNext(View next) {
String enteredId = editTxtLrzId.getText()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Reporter: PMD
Rule: UseLocaleWithCaseConversions
Severity: WARN
File: app/src/main/java/de/tum/in/tumcampusapp/component/ui/onboarding/WizNavStartActivity.java L75

When doing a String.toLowerCase()/toUpperCase() call, use a Locale

Design https://pmd.github.io/pmd-5.6.1/pmd-java/rules/java/design.html#UseLocaleWithCaseConversions

<-139688394>

.toString()
.toLowerCase();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Reporter: ANDROIDLINT
Rule: Correctness
Severity: WARN
File: app/src/main/java/de/tum/in/tumcampusapp/component/ui/onboarding/WizNavStartActivity.java L77

DefaultLocale: Implied default locale in case conversion
Implicitly using the default locale is a common source of bugs: Use toLowerCase(Locale) instead. For strings meant to be internal use Locale.ROOT, otherwise Locale.getDefault().
Calling String#toLowerCase() or #toUpperCase() without specifying an explicit locale is a common source of bugs. The reason for that is that those methods will use the current locale on the user's device, and even though the code appears to work correctly when you are developing the app, it will fail in some locales. For example, in the Turkish locale, the uppercase replacement for i is not I. If you want the methods to just perform ASCII replacement, for example to convert an enum name, call String#toUpperCase(Locale.US) instead. If you really want to use the current locale, call String#toUpperCase(Locale.getDefault()) instead.

<1326609218>

String punishMe = editTxtLrzId.getText()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Reporter: PMD
Rule: PrematureDeclaration
Severity: WARN
File: app/src/main/java/de/tum/in/tumcampusapp/component/ui/onboarding/WizNavStartActivity.java L78

Avoid declaring a variable if it is unreferenced before a possible exit point.

Optimization https://pmd.github.io/pmd-5.6.1/pmd-java/rules/java/optimizations.html#PrematureDeclaration

<-1744084493>

Copy link
Collaborator

Choose a reason for hiding this comment

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

Reporter: PMD
Rule: UnusedLocalVariable
Severity: WARN
File: app/src/main/java/de/tum/in/tumcampusapp/component/ui/onboarding/WizNavStartActivity.java L78

Avoid unused local variables such as 'punishMe'.

Unused Code https://pmd.github.io/pmd-5.6.1/pmd-java/rules/java/unusedcode.html#UnusedLocalVariable

<273573064>

Copy link
Collaborator

Choose a reason for hiding this comment

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

Reporter: PMD
Rule: UseLocaleWithCaseConversions
Severity: WARN
File: app/src/main/java/de/tum/in/tumcampusapp/component/ui/onboarding/WizNavStartActivity.java L78

When doing a String.toLowerCase()/toUpperCase() call, use a Locale

Design https://pmd.github.io/pmd-5.6.1/pmd-java/rules/java/design.html#UseLocaleWithCaseConversions

<-1256775008>

.toString()
.toLowerCase();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Reporter: ANDROIDLINT
Rule: Correctness
Severity: WARN
File: app/src/main/java/de/tum/in/tumcampusapp/component/ui/onboarding/WizNavStartActivity.java L80

DefaultLocale: Implied default locale in case conversion
Implicitly using the default locale is a common source of bugs: Use toLowerCase(Locale) instead. For strings meant to be internal use Locale.ROOT, otherwise Locale.getDefault().
Calling String#toLowerCase() or #toUpperCase() without specifying an explicit locale is a common source of bugs. The reason for that is that those methods will use the current locale on the user's device, and even though the code appears to work correctly when you are developing the app, it will fail in some locales. For example, in the Turkish locale, the uppercase replacement for i is not I. If you want the methods to just perform ASCII replacement, for example to convert an enum name, call String#toUpperCase(Locale.US) instead. If you really want to use the current locale, call String#toUpperCase(Locale.getDefault()) instead.

<967717779>


// check if lrz could be valid?
if (!enteredId.matches(Const.TUM_ID_PATTERN)) {
Expand Down