davidmigloz/go-bees

View on GitHub

Showing 100 of 387 total issues

Method getStringForWeatherCondition has 219 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static String getStringForWeatherCondition(Context context, int weatherId) {
        int stringId;
        switch (weatherId) {
            case 200:
                stringId = R.string.condition_200;
Severity: Major
Found in app/src/main/java/com/davidmiguel/gobees/utils/WeatherUtils.java - About 1 day to fix

    File GoBeesLocalDataSource.java has 454 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * GoBees
     * Copyright (c) 2016 - 2017 David Miguel Lozano
     *
     * This program is free software: you can redistribute it and/or modify

      GoBeesLocalDataSource has 41 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class GoBeesLocalDataSource implements GoBeesDataSource {
      
          // Fields names
          private static final String ID = "id";
          private static final String TIMESTAMP = "timestamp";

        Method parseCurrentWeatherJson has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

            static MeteoRecord parseCurrentWeatherJson(String weatherJson) throws JSONException {
                // Get JSON
                JSONObject jsonObject = new JSONObject(weatherJson);
        
                // Check errors

        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

        GoBeesRepository has 36 methods (exceeds 20 allowed). Consider refactoring.
        Open

        @SuppressWarnings("WeakerAccess")
        public class GoBeesRepository implements GoBeesDataSource {
        
            private static GoBeesRepository instance = null;
        

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

          public class HiveRecordingsFragment extends Fragment
                  implements BaseTabFragment, HiveContract.HiveRecordingsView, RecordingsAdapter.RecordingItemListener {
          
              public static final String ARGUMENT_APIARY_ID = "APIARY_ID";
              public static final String ARGUMENT_HIVE_ID = "HIVE_ID";

            File RecordingFragment.java has 339 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*
             * GoBees
             * Copyright (c) 2016 - 2017 David Miguel Lozano
             *
             * This program is free software: you can redistribute it and/or modify

              File WeatherUtils.java has 327 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*
               * GoBees
               * Copyright (c) 2016 - 2017 David Miguel Lozano
               *
               * This program is free software: you can redistribute it and/or modify
              Severity: Minor
              Found in app/src/main/java/com/davidmiguel/gobees/utils/WeatherUtils.java - About 3 hrs to fix

                MeteoRecord has 30 methods (exceeds 20 allowed). Consider refactoring.
                Open

                @SuppressWarnings("unused")
                public class MeteoRecord extends RealmObject {
                
                    @PrimaryKey
                    private long id;
                Severity: Minor
                Found in app/src/main/java/com/davidmiguel/gobees/data/model/MeteoRecord.java - About 3 hrs to fix

                  GoBeesRepositoryTest has 29 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  public class GoBeesRepositoryTest {
                  
                      private static final long APIARY_ID = 1;
                  
                      private static final long HIVE_ID = 1;

                    MonitoringFragment has 28 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    public class MonitoringFragment extends Fragment implements MonitoringContract.View,
                            BackClickHelperFragment {
                    
                        public static final String ARGUMENT_APIARY_ID = "APIARY_ID";
                        public static final String ARGUMENT_HIVE_ID = "HIVE_ID";

                      GoBeesDataSource has 27 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      public interface GoBeesDataSource {
                      
                          /**
                           * Opens database.
                           */

                        AddEditApiaryFragment has 27 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        public class AddEditApiaryFragment extends Fragment implements AddEditApiaryContract.View {
                        
                            public static final String ARGUMENT_EDIT_APIARY_ID = "EDIT_APIARY_ID";
                        
                            private AddEditApiaryContract.Presenter presenter;

                          ApiaryHivesFragment has 26 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          public class ApiaryHivesFragment extends Fragment
                                  implements BaseTabFragment, ApiaryContract.ApiaryHivesView, HivesAdapter.HiveItemListener {
                          
                              public static final String ARGUMENT_APIARY_ID = "APIARY_ID";
                          

                            Method parseCurrentWeatherJson has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                static MeteoRecord parseCurrentWeatherJson(String weatherJson) throws JSONException {
                                    // Get JSON
                                    JSONObject jsonObject = new JSONObject(weatherJson);
                            
                                    // Check errors

                              RecordingFragment has 25 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              public class RecordingFragment extends Fragment implements RecordingContract.View {
                              
                                  public static final String ARGUMENT_APIARY_ID = "APIARY_ID";
                                  public static final String ARGUMENT_HIVE_ID = "HIVE_ID";
                                  public static final String ARGUMENT_START_DATE = "START_DATE";

                                ApiariesFragment has 25 methods (exceeds 20 allowed). Consider refactoring.
                                Open

                                public class ApiariesFragment extends Fragment
                                        implements ApiariesContract.View, ApiaryItemListener {
                                
                                    private ApiariesContract.LoadDataPresenter presenter;
                                    private ApiariesAdapter listAdapter;

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

                                      @Nullable
                                      @Override
                                      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                                               Bundle savedInstanceState) {
                                          View root = inflater.inflate(R.layout.monitoring_frag, container, false);

                                    Method listHivesTest has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        @Test
                                        public void listHivesTest() {
                                            ViewInteraction floatingActionButton = onView(
                                                    allOf(withId(R.id.fab_add_apiary),
                                                            withParent(withId(R.id.coordinatorLayout)),

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

                                      public class MonitoringSettingsFragment extends PreferenceFragment
                                              implements MonitoringContract.SettingsView, Preference.OnPreferenceChangeListener {
                                      
                                          private MonitoringContract.Presenter presenter;
                                          private RelativeLayout settingsLayout;
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language