coding-blocks/DigitalOceanApp

View on GitHub

Showing 29 of 1,612 total issues

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;

              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);

                        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),

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

                                @Override
                                public void onBindViewHolder(final ViewHolder holder, final int position) {
                            
                                    holder.imageName.setText(imageList.get(position).getName());
                                    this.position = holder.getAdapterPosition();

                              Method setAdditionalOptions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public void setAdditionalOptions() {
                                      cbPrivateNetworking.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                                          @Override
                                          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                                              if (isChecked) {

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

                                    @Override
                                    protected void onCreate(Bundle savedInstanceState) {
                                        super.onCreate(savedInstanceState);
                                
                                        String authToken = getSharedPreferences("DO", MODE_PRIVATE).getString("authToken", "");

                                  Method onBindViewHolder has a Cognitive Complexity of 11 (exceeds 5 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);

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

                                      public static void onLoggedIn(String token) {
                                          DigitalOcean.authToken = token;
                                  
                                          if (okHttpClient == null) {
                                              OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder()
                                  Severity: Minor
                                  Found in doandroidlib/src/main/java/in/tosc/doandroidlib/DigitalOcean.java - About 1 hr to fix

                                    Method onNavigationItemSelected has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

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