coding-blocks/DigitalOceanApp

View on GitHub

Showing 1,612 of 1,612 total issues

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

/**
 * The MIT License
 * 
 * Copyright (c) 2013-2016 Jeevanandam M. (myjeeva.com)
 * 
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Domains.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Droplets.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Images.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Neighbors.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Sizes.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Volumes.java on lines 1..46

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

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

/**
 * The MIT License
 * 
 * Copyright (c) 2013-2016 Jeevanandam M. (myjeeva.com)
 * 
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Actions.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Droplets.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Images.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Neighbors.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Sizes.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Volumes.java on lines 1..46

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

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

/**
 * The MIT License
 * 
 * Copyright (c) 2013-2016 Jeevanandam M. (myjeeva.com)
 * 
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Actions.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Domains.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Images.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Neighbors.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Sizes.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Volumes.java on lines 1..46

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

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

/**
 * The MIT License
 * 
 * Copyright (c) 2013-2016 Jeevanandam M. (myjeeva.com)
 * 
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Actions.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Domains.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Droplets.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Images.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Sizes.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Volumes.java on lines 1..46

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

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

/**
 * The MIT License
 * 
 * Copyright (c) 2013-2016 Jeevanandam M. (myjeeva.com)
 * 
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Actions.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Domains.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Droplets.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Images.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Neighbors.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Volumes.java on lines 1..46

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

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

            public boolean matchesSafely(View view) {

                this.resources = view.getResources();

                if (childView == null) {

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

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

/**
 * Copyright (c) Jeevanandam M. (https://github.com/jeevatkm)
 * 
 * digitalocean-api-client source code and usage is governed by a MIT style license that can be
 * found in the LICENSE file
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Actions.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Domains.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Droplets.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Images.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Neighbors.java on lines 1..59
doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Sizes.java on lines 1..59

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

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

            case 2:
                DataCenterFragment selectDataCenter = new DataCenterFragment();
                fragmentTransaction.replace(R.id.fragmentHolder, selectDataCenter, "DATA_CENTER");
                fragmentTransaction.addToBackStack("DataCenterFragment");
                fragmentTransaction.commit();
app/src/main/java/in/tosc/digitaloceanapp/activities/DropletCreateActivity.java on lines 76..81

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

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 3:
                SelectSizeFragment selectSizeFragment = new SelectSizeFragment();
                fragmentTransaction.replace(R.id.fragmentHolder, selectSizeFragment, "SELECT_SIZE");
                fragmentTransaction.addToBackStack("selectSizeFragment");
                fragmentTransaction.commit();
app/src/main/java/in/tosc/digitaloceanapp/activities/DropletCreateActivity.java on lines 70..75

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

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

Avoid too many return statements within this method.
Open

        return super.onOptionsItemSelected(item);

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

            if (id == R.id.nav_profile) {
                url = "https://cloud.digitalocean.com/settings/profile";
                Intent i = new Intent(Intent.ACTION_VIEW);
                i.setData(Uri.parse(url));
                startActivity(i);
    app/src/main/java/in/tosc/digitaloceanapp/activities/DropletActivity.java on lines 231..236
    app/src/main/java/in/tosc/digitaloceanapp/activities/DropletActivity.java on lines 218..223

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

    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

            } else if (id == R.id.nav_billing) {
                url = "https://cloud.digitalocean.com/settings/billing";
                Intent i = new Intent(Intent.ACTION_VIEW);
                i.setData(Uri.parse(url));
                startActivity(i);
    app/src/main/java/in/tosc/digitaloceanapp/activities/DropletActivity.java on lines 231..236
    app/src/main/java/in/tosc/digitaloceanapp/activities/DropletActivity.java on lines 212..218

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

    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

    Avoid too many return statements within this method.
    Open

                return true;

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

              } else if (id == R.id.nav_manage) {
                  url = "https://cloud.digitalocean.com/settings";
                  Intent i = new Intent(Intent.ACTION_VIEW);
                  i.setData(Uri.parse(url));
                  startActivity(i);
      app/src/main/java/in/tosc/digitaloceanapp/activities/DropletActivity.java on lines 218..223
      app/src/main/java/in/tosc/digitaloceanapp/activities/DropletActivity.java on lines 212..218

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

      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

      Method onOptionsItemSelected has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public boolean onOptionsItemSelected(MenuItem item) {
              int id = item.getItemId();
              if (id == R.id.delete_droplet) {
      
      

      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 onNavigationItemSelected has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          @SuppressWarnings("StatementWithEmptyBody")
          @Override
          public boolean onNavigationItemSelected(MenuItem item) {
              // Handle navigation view item clicks here.
              int id = item.getItemId();

      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

      Extra separation in import group before 'in.tosc.digitaloceanapp.matchers.RecyclerViewMatcher.withRecyclerView'
      Open

      import static in.tosc.digitaloceanapp.matchers.RecyclerViewMatcher.withRecyclerView;

      Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

      This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

      Line is longer than 100 characters (found 107).
      Open

          public void startApp () throws IllegalAccessException, ClassNotFoundException, InstantiationException {

      Checks for long lines.

      Rationale: Long lines are hard to read in printouts or if developershave limited screen space for the source code, e.g. if the IDEdisplays additional information like project tree, class hierarchy,etc.

      This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

      Line is longer than 100 characters (found 177).
      Open

                      android:text="Give your Droplets an identifying name you will remember them by. Your Droplet name can only contain alphanumeric characters, dashes, and periods."

      Checks for long lines.

      Rationale: Long lines are hard to read in printouts or if developershave limited screen space for the source code, e.g. if the IDEdisplays additional information like project tree, class hierarchy,etc.

      This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

      Wrong lexicographical order for 'android.support.test.espresso.assertion.ViewAssertions.matches' import. Should be before 'android.support.test.runner.AndroidJUnit4'.
      Open

      import static android.support.test.espresso.assertion.ViewAssertions.matches;

      Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

      This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

      Severity
      Category
      Status
      Source
      Language