-
-
Notifications
You must be signed in to change notification settings - Fork 86
Checking jenkins to github commenter functionality for androidlint reports #735
Conversation
@@ -75,6 +75,9 @@ public void onClickNext(View next) { | |||
String enteredId = editTxtLrzId.getText() | |||
.toString() | |||
.toLowerCase(); |
There was a problem hiding this comment.
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>
@@ -75,6 +75,9 @@ public void onClickNext(View next) { | |||
String enteredId = editTxtLrzId.getText() | |||
.toString() | |||
.toLowerCase(); | |||
String punishMe = editTxtLrzId.getText() | |||
.toString() | |||
.toLowerCase(); |
There was a problem hiding this comment.
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>
@@ -75,6 +75,9 @@ public void onClickNext(View next) { | |||
String enteredId = editTxtLrzId.getText() |
There was a problem hiding this comment.
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>
@@ -75,6 +75,9 @@ public void onClickNext(View next) { | |||
String enteredId = editTxtLrzId.getText() | |||
.toString() | |||
.toLowerCase(); | |||
String punishMe = editTxtLrzId.getText() |
There was a problem hiding this comment.
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>
@@ -75,6 +75,9 @@ public void onClickNext(View next) { | |||
String enteredId = editTxtLrzId.getText() | |||
.toString() | |||
.toLowerCase(); | |||
String punishMe = editTxtLrzId.getText() |
There was a problem hiding this comment.
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>
@@ -75,6 +75,9 @@ public void onClickNext(View next) { | |||
String enteredId = editTxtLrzId.getText() | |||
.toString() | |||
.toLowerCase(); | |||
String punishMe = editTxtLrzId.getText() |
There was a problem hiding this comment.
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>
That's a positive |
cool beans 👍 |
Please do not merge this.