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

Conversation

psukys
Copy link
Member

@psukys psukys commented Mar 2, 2018

Please do not merge this.

@@ -75,6 +75,9 @@ public void onClickNext(View next) {
String enteredId = editTxtLrzId.getText()
.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>

@@ -75,6 +75,9 @@ public void onClickNext(View next) {
String enteredId = editTxtLrzId.getText()
.toString()
.toLowerCase();
String punishMe = editTxtLrzId.getText()
.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>

@@ -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>

@@ -75,6 +75,9 @@ public void onClickNext(View next) {
String enteredId = editTxtLrzId.getText()
.toString()
.toLowerCase();
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>

@@ -75,6 +75,9 @@ public void onClickNext(View next) {
String enteredId = editTxtLrzId.getText()
.toString()
.toLowerCase();
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: 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()
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>

@psukys
Copy link
Member Author

psukys commented Mar 2, 2018

That's a positive

@psukys psukys closed this Mar 2, 2018
@psukys psukys mentioned this pull request Mar 2, 2018
@kordianbruck kordianbruck deleted the psukys/check-androidlint-github-commenter branch March 3, 2018 15:05
@kordianbruck
Copy link
Member

cool beans 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants