berict/Tapad

View on GitHub
app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java

Summary

Maintainability
F
5 days
Test Coverage

Method getExceptionalRunnable has 274 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private Runnable getExceptionalRunnable(String textId) {
        Runnable exceptionalRunnable;
        final Activity a = activity;
        final WindowHelper w = new WindowHelper();

Severity: Major
Found in app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java - About 1 day to fix

    File ItemAdapter.java has 411 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package com.bedrock.padder.adapter;
    
    import android.app.Activity;
    import android.content.Context;
    import android.support.annotation.NonNull;
    Severity: Minor
    Found in app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java - About 5 hrs to fix

      ItemAdapter has 33 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class ItemAdapter extends RecyclerView.Adapter<ItemAdapter.DetailViewHolder> {
          private Item[] item;
          private int rowLayout;
          private Context context;
          private Activity activity;
      Severity: Minor
      Found in app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java - About 4 hrs to fix

        Method onBindViewHolder has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            @Override
            public void onBindViewHolder(final DetailViewHolder holder, int position) {
                holder.itemText.setText(item[position].getText(context));
        
                if (item[position].getHint(context) == null || item[position].getHint(context).equals("")) {
        Severity: Minor
        Found in app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java - About 3 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 onBindViewHolder has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public void onBindViewHolder(final DetailViewHolder holder, int position) {
                holder.itemText.setText(item[position].getText(context));
        
                if (item[position].getHint(context) == null || item[position].getHint(context).equals("")) {
        Severity: Major
        Found in app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java - About 2 hrs to fix

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

                      case "info_berict_action_report_bug":
                          exceptionalRunnable = new Runnable() {
                              @Override
                              public void run() {
                                  new MaterialDialog.Builder(activity)
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 300..326

          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 121.

          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 "info_tapad_others_report_bug":
                          exceptionalRunnable = new Runnable() {
                              @Override
                              public void run() {
                                  new MaterialDialog.Builder(activity)
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 368..394

          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 121.

          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 (item[position].getHint(context).startsWith("http")) {
                          // link available check
                          anim.circularRevealTouch(holder.itemLayout, R.id.layout_placeholder,
                                  new AccelerateDecelerateInterpolator(), new Runnable() {
                                      @Override
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 92..102

          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 95.

          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 (item[position].getHint(context).startsWith("http")) {
                          // link available check
                          anim.circularRevealTouch(holder.itemLayout, R.id.layout_placeholder,
                                  new AccelerateDecelerateInterpolator(), new Runnable() {
                                      @Override
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 107..117

          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 95.

          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 "info_tapad_others_translate":
                          exceptionalRunnable = new Runnable() {
                              @Override
                              public void run() {
                                  new MaterialDialog.Builder(activity)
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 404..423

          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 88.

          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 "info_berict_action_contribute":
                          exceptionalRunnable = new Runnable() {
                              @Override
                              public void run() {
                                  new MaterialDialog.Builder(activity)
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 336..355

          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 88.

          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 3 locations. Consider refactoring.
          Open

                      case "info_tapad_info_thanks":
                          exceptionalRunnable = new Runnable() {
                              @Override
                              public void run() {
                                  // thanks info dialog
          Severity: Major
          Found in app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java and 2 other locations - About 55 mins to fix
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 191..205
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 206..220

          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 65.

          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 3 locations. Consider refactoring.
          Open

                      case "info_tapad_info_legal":
                          exceptionalRunnable = new Runnable() {
                              @Override
                              public void run() {
                                  // legal info dialog
          Severity: Major
          Found in app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java and 2 other locations - About 55 mins to fix
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 206..220
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 221..235

          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 65.

          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 3 locations. Consider refactoring.
          Open

                      case "info_tapad_info_changelog":
                          exceptionalRunnable = new Runnable() {
                              @Override
                              public void run() {
                                  // changelog info dialog
          Severity: Major
          Found in app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java and 2 other locations - About 55 mins to fix
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 191..205
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 221..235

          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 65.

          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 "info_tapad_info_tester":
                          exceptionalRunnable = new Runnable() {
                              @Override
                              public void run() {
                                  w.setRecentColor(w.getStringId("info_tapad_info_tester"), R.color.colorAccent, a);
          Severity: Minor
          Found in app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java and 1 other location - About 45 mins to fix
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 173..181

          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 53.

          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 "info_tapad_info_check_update":
                          exceptionalRunnable = new Runnable() {
                              @Override
                              public void run() {
                                  w.setRecentColor(w.getStringId("info_tapad_info_check_update"), R.color.colorAccent, a);
          Severity: Minor
          Found in app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java and 1 other location - About 45 mins to fix
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 182..190

          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 53.

          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 7 locations. Consider refactoring.
          Open

              public ItemAdapter(Item[] item, int rowLayout, Context context, Activity activity) {
                  this.item = item;
                  this.rowLayout = rowLayout;
                  this.context = context;
                  this.activity = activity;
          Severity: Major
          Found in app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java and 6 other locations - About 40 mins to fix
          app/src/main/java/com/bedrock/padder/adapter/ColorAdapter.java on lines 52..57
          app/src/main/java/com/bedrock/padder/adapter/DetailAdapter.java on lines 32..37
          app/src/main/java/com/bedrock/padder/model/about/Bio.java on lines 20..25
          app/src/main/java/com/bedrock/padder/model/about/Item.java on lines 35..40
          app/src/main/java/com/bedrock/padder/model/preset/PresetSchema.java on lines 183..188
          app/src/main/java/com/bedrock/padder/model/preset/Review.java on lines 15..20

          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 49.

          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 "info_berict_action_rate":
                          exceptionalRunnable = new Runnable() {
                              @Override
                              public void run() {
                                  w.setRecentColor(w.getStringId("info_berict_action_rate"), R.color.colorAccent, a);
          Severity: Minor
          Found in app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java and 1 other location - About 40 mins to fix
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 327..335

          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 49.

          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 "info_tapad_others_rate":
                          exceptionalRunnable = new Runnable() {
                              @Override
                              public void run() {
                                  w.setRecentColor(w.getStringId("info_tapad_others_rate"), R.color.colorAccent, a);
          Severity: Minor
          Found in app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java and 1 other location - About 40 mins to fix
          app/src/main/java/com/bedrock/padder/adapter/ItemAdapter.java on lines 395..403

          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 49.

          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