davidmigloz/go-bees

View on GitHub

Showing 100 of 387 total issues

Method checkCameraPermission has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public boolean checkCameraPermission() {
        // Check camera permission
        if (PermissionUtils.isGranted(getActivity(), PermissionEnum.CAMERA)) {
            return true;

    Method onStartCommand has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        public int onStartCommand(Intent intent, int flags, int startId) {
            super.onStartCommand(intent, flags, startId);
    
            // START action

      Method deleteApiaryTest has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Method addHiveTest has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Method checkCurrentWeather has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              private void checkCurrentWeather(boolean forceUpdate, List<Apiary> apiaries) {
                  List<Apiary> apiariesToUpdate = new ArrayList<>();
                  Date now = new Date();
                  // Check dates
                  for (Apiary apiary : apiaries) {

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

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

            Method viewApiaryTest has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Method onCreate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  @Override
                  protected void onCreate(Bundle savedInstanceState) {
                      super.onCreate(savedInstanceState);
                      setContentView(R.layout.addedithive_act);
              

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

                  @SuppressWarnings("ConstantConditions")
                  @Override
                  public void updateApiariesCurrentWeather(final List<Apiary> apiariesToUpdate,
                                                           @NonNull TaskCallback callback) {
                      try {

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

                    public static int getWeatherIconResourceId(String weatherIconId) {
                        switch (weatherIconId) {
                            case "01d": // clear sky day
                                return R.drawable.ic_weather_day_clear_sky;
                            case "01n": // clear sky night
                Severity: Minor
                Found in app/src/main/java/com/davidmiguel/gobees/utils/WeatherUtils.java - About 1 hr to fix

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

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

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

                        @SuppressWarnings("ConstantConditions")
                        @Override
                        public void updateApiariesCurrentWeather(final List<Apiary> apiariesToUpdate,
                                                                 @NonNull final TaskCallback callback) {
                            checkNotNull(callback);

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

                          @Override
                          public void loadData(boolean forceUpdate) {
                              // Force update the first time
                              boolean update = forceUpdate || firstLoad;
                              firstLoad = false;

                        Method onCreate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            @Override
                            protected void onCreate(Bundle savedInstanceState) {
                                super.onCreate(savedInstanceState);
                                setContentView(R.layout.addeditapiary_act);
                        

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

                            private LineDataSet configureWeatherChart(
                                    LineChart chart, int chartName, int colorLineTempChart, int colorFillTempChart,
                                    List<Entry> entries, IAxisValueFormatter formatter, double minVal, double maxVal) {
                                LineDataSet lineDataSet = new LineDataSet(entries, getString(chartName));
                                lineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);

                          Method getHiveWithRecordings has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              @Override
                              public void getHiveWithRecordings(long hiveId, @NonNull GetHiveCallback callback) {
                                  try {
                                      // Get hive
                                      Hive hive = realm.where(Hive.class).equalTo(ID, hiveId).findFirst();

                            Method loadData has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                @Override
                                public void loadData(boolean forceUpdate) {
                                    // Force update the first time
                                    boolean update = forceUpdate || firstLoad;
                                    firstLoad = false;
                            Severity: Minor
                            Found in app/src/main/java/com/davidmiguel/gobees/hive/HivePresenter.java - About 1 hr to fix

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

                                  @Override
                                  protected void onCreate(Bundle savedInstanceState) {
                                      super.onCreate(savedInstanceState);
                                      setContentView(R.layout.addedithive_act);
                              

                                Method getRecording has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    @Override
                                    public void getRecording(long apiaryId, long hiveId, Date start, Date end,
                                                             @NonNull GetRecordingCallback callback) {
                                        // Get apiary
                                        Apiary apiary = realm.where(Apiary.class).equalTo(ID, apiaryId).findFirst();

                                  Method onCreateView has 29 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.recording_frag, container, false);
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language