coding-blocks/DigitalOceanApp

View on GitHub

Showing 1,612 of 1,612 total issues

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

                "{\n" +
                        "  \"sizes\": [\n" +
                        "    {\n" +
                        "      \"slug\": \"512mb\",\n" +
                        "      \"memory\": 512,\n" +
doandroidlib/src/main/java/in/tosc/doandroidlib/mockapi/MockResponses.java on lines 363..551

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

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

                "{\n" +
                        "  \"regions\": [\n" +
                        "    {\n" +
                        "      \"name\": \"New York 1\",\n" +
                        "      \"slug\": \"nyc1\",\n" +
doandroidlib/src/main/java/in/tosc/doandroidlib/mockapi/MockResponses.java on lines 134..322

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

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

File MockResponses.java has 545 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package in.tosc.doandroidlib.mockapi;

import java.util.HashMap;
import java.util.Map;

    Droplet has 49 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class Droplet extends RateLimitBase {
    
        private static final long serialVersionUID = 1110964622197874436L;
    
        private Integer id;
    Severity: Minor
    Found in doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Droplet.java - About 6 hrs to fix

      Method onCheckedChanged has 142 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          public void onCheckedChanged(CompoundButton buttonView, final boolean isChecked) {
              switch (buttonView.getId()) {
                  case R.id.switch_ipv6:
                      if (isChecked) {

        File DetailDropletActivity.java has 345 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        package in.tosc.digitaloceanapp.activities;
        
        import android.databinding.DataBindingUtil;
        import android.os.Bundle;
        import android.support.annotation.NonNull;

          Method onOptionsItemSelected has 101 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            DetailDropletActivity has 31 methods (exceeds 20 allowed). Consider refactoring.
            Open

            public class DetailDropletActivity extends AppCompatActivity implements CompoundButton.OnCheckedChangeListener {
            
                private Droplet droplet;
                private DigitalOceanClient doaClient;
                private int position;

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

                          case R.id.switch_private_network:
                              if (isChecked) {
                                  doaClient.performAction(droplet.getId(),
                                          ActionType.ENABLE_PRIVATE_NETWORKING,
                                          null)
              app/src/main/java/in/tosc/digitaloceanapp/activities/DetailDropletActivity.java on lines 200..240

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

              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 R.id.switch_ipv6:
                              if (isChecked) {
                                  doaClient.performAction(droplet.getId(), ActionType.ENABLE_IPV6, null)
                                          .enqueue(new Callback<Action>() {
                                              @Override
              app/src/main/java/in/tosc/digitaloceanapp/activities/DetailDropletActivity.java on lines 242..282

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

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

                  public Matcher<View> atPositionOnView(final int position, final int targetViewId) {
              
                      return new TypeSafeMatcher<View>() {
                          Resources resources = null;
                          View childView;

              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

              Image has 22 methods (exceeds 20 allowed). Consider refactoring.
              Open

              public class Image extends RateLimitBase {
              
                private static final long serialVersionUID = 1321111459154107563L;
              
                private Integer id;
              Severity: Minor
              Found in doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Image.java - About 2 hrs to fix

                Method onCreate has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @Override
                    protected void onCreate(Bundle savedInstanceState) {
                        super.onCreate(savedInstanceState);
                
                        FontsOverride.applyFontForToolbarTitle(this, FontsOverride.FONT_PROXIMA_NOVA);

                  Method onCreate has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Override
                      protected void onCreate(Bundle savedInstanceState) {
                          super.onCreate(savedInstanceState);
                  
                          requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

                    Method onBindViewHolder has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @Override
                        public void onBindViewHolder(final DataCenterViewHolder holder, final int position) {
                            this.postion = holder.getAdapterPosition();
                            String thisRegion = regions.getRegions().get(position).getName();
                            holder.countryName.setText(thisRegion);

                      Method onCreateView has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          @Override
                          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                                   Bundle savedInstanceState) {
                              // Inflate the layout for this fragment
                              View view = inflater.inflate(R.layout.fragment_additional_details, container, false);

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

                            class DataCenterViewHolder extends RecyclerView.ViewHolder {
                        
                                TextView countryName;
                                ImageView img;
                                LinearLayout countryLayout;
                        app/src/main/java/in/tosc/digitaloceanapp/adapters/ImageAdapter.java on lines 150..163

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

                        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

                            class ViewHolder extends RecyclerView.ViewHolder {
                                ImageView imageImage;
                                TextView imageName;
                                TextView imageDistribution;
                                CardView imageCard;
                        app/src/main/java/in/tosc/digitaloceanapp/adapters/DataCenterAdapter.java on lines 121..139

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

                        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 atPositionOnView has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public Matcher<View> atPositionOnView(final int position, final int targetViewId) {
                        
                                return new TypeSafeMatcher<View>() {
                                    Resources resources = null;
                                    View childView;

                          Method onBindViewHolder has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              @Override
                              public void onBindViewHolder(final SelectSizeAdapter.ViewHolder holder, final int position) {
                          
                                  holder.monthlyPrice.setText(String.format(context.getString(R.string.monthly_price), sizeList.get(position).getPriceMonthly().toString()));
                                  holder.hourlyPrice.setText(String.format(context.getString(R.string.hourly_price),
                            Severity
                            Category
                            Status
                            Source
                            Language