berict/Tapad

View on GitHub
app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java

Summary

Maintainability
F
5 days
Test Coverage

File FeedbackActivity.java has 479 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.bedrock.padder.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Build;
Severity: Minor
Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 7 hrs to fix

    Method validateEditText has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

        private boolean validateEditText(EditText editText) {
            Log.d(TAG, "validateEditText");
            switch (MODE_TAG) {
                case "song":
                    if (editText == songName) {
    Severity: Minor
    Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 5 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method initUi has 109 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private void initUi() {
            switch (MODE_TAG) {
                case "song":
                    // layout
                    RelativeLayout songLayout = findViewById(R.id.feedback_song);
    Severity: Major
    Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 4 hrs to fix

      Method validateEditText has 92 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private boolean validateEditText(EditText editText) {
              Log.d(TAG, "validateEditText");
              switch (MODE_TAG) {
                  case "song":
                      if (editText == songName) {
      Severity: Major
      Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 3 hrs to fix

        FeedbackActivity has 24 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public class FeedbackActivity extends AppCompatActivity {
        
            final String TAG = "FeedbackActivity";
            String MODE_TAG = "";
        
        
        Severity: Minor
        Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 2 hrs to fix

          Method send has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private boolean send() {
                  if (validateAll() == true) {
                      switch (MODE_TAG) {
                          case "song":
                              sendMessage =   "Song title   = \"" + songNameString    + "\"" + br +
          Severity: Minor
          Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 1 hr to fix

            Method validateSpinner has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                private boolean validateSpinner(boolean firstRun, int errorViewId, String spinnerCurrentItemString) {
                    if (firstRun) {
                        switch (MODE_TAG) {
                            case "song":
                                songGenreValidateFirstRun = false;
            Severity: Minor
            Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method validateAll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                private boolean validateAll() {
                    switch (MODE_TAG) {
                        case "song":
                            if (validateEditText(songName) &
                                    validateEditText(songArtist) &
            Severity: Minor
            Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 35 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Avoid too many return statements within this method.
            Open

                                return true;
            Severity: Major
            Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                      return false;
              Severity: Major
              Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return false;
                Severity: Major
                Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                      return true;
                  Severity: Major
                  Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                            return false;
                    Severity: Major
                    Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                          return true;
                      Severity: Major
                      Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                            return true;
                        Severity: Major
                        Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                                  return false;
                          Severity: Major
                          Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                                    return false;
                            Severity: Major
                            Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                                      return false;
                              Severity: Major
                              Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                        return false;
                                Severity: Major
                                Found in app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java - About 30 mins to fix

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                              case "feedback":
                                                  if (editText == feedbackMessage) {
                                                      if (feedbackMessage.getText().toString().trim().isEmpty()) {
                                                          // string empty
                                                          feedbackMessageLayout.setErrorTextAppearance(R.style.editTextErrorDefault);
                                  app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java on lines 362..385

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 168.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                              case "report_bug":
                                                  if (editText == reportBugMessage) {
                                                      if (reportBugMessage.getText().toString().trim().isEmpty()) {
                                                          // string empty
                                                          reportBugMessageLayout.setErrorTextAppearance(R.style.editTextErrorDefault);
                                  app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java on lines 338..361

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 168.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                                  case "report_bug":
                                                      sendMessage =
                                                              "Bug type   = \"" + reportBugTypeString    + "\"" + br +
                                                              "Bug detail = \"" + reportBugMessageString + "\"" + br + br +
                                                              systemInfo + br + "FeedbackId2" + br + br +
                                  app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java on lines 446..454

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 104.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                                  case "feedback":
                                                      sendMessage =   "Feedback type    = \"" + feedbackTypeString    + "\"" + br +
                                                                      "Feedback message = \"" + feedbackMessageString + "\"" + br + br +
                                                                      systemInfo + br + "FeedbackId1" + br + br +
                                                              "### Do not edit the subject and the message to receive a reply ###";
                                  app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java on lines 455..464

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 104.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                                  if (editText == songName) {
                                                      if (songName.getText().toString().trim().isEmpty()) {
                                                          // string empty
                                                          songNameLayout.setError(getResources().getString(R.string.feedback_song_name_input_error));
                                                          songName.requestFocus();
                                  app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java on lines 304..315

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 76.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                                  if (editText == songArtist) {
                                                      if (songArtist.getText().toString().trim().isEmpty()) {
                                                          // string empty
                                                          songArtistLayout.setError(getResources().getString(R.string.feedback_song_artist_input_error));
                                                          songArtist.requestFocus();
                                  app/src/main/java/com/bedrock/padder/activity/FeedbackActivity.java on lines 292..303

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 76.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                                  w.setOnClick(R.id.feedback_report_bug_type_quickfix_action, new Runnable() {
                                                      @Override
                                                      public void run() {
                                                          new MaterialDialog.Builder(a)
                                                                  .content(R.string.feedback_report_bug_type_quickfix_content)
                                  app/src/main/java/com/bedrock/padder/fragment/PresetStoreOnlineFragment.java on lines 144..154

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 45.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  There are no issues that match your filters.

                                  Category
                                  Status