CultureQuestORG/SDP2023

View on GitHub
app/src/main/java/ch/epfl/culturequest/ui/map/MapsFragment.java

Summary

Maintainability
C
7 hrs
Test Coverage
F
21%

Method getDeviceLocation has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    private void getDeviceLocation() {
        /*
         * Get the best and most recent location of the device, which may be null in rare
         * cases when a location is not available.
         */
Severity: Minor
Found in app/src/main/java/ch/epfl/culturequest/ui/map/MapsFragment.java - About 4 hrs to fix

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

File MapsFragment.java has 297 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

package ch.epfl.culturequest.ui.map;

import android.Manifest;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
Severity: Minor
Found in app/src/main/java/ch/epfl/culturequest/ui/map/MapsFragment.java - About 3 hrs to fix

    Method onLocationResult has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

                        @Override
                        public void onLocationResult(@NonNull LocationResult result) {
                            super.onLocationResult(result);
                            if (result != null) {
                                for (Location location : result.getLocations()) {
    Severity: Minor
    Found in app/src/main/java/ch/epfl/culturequest/ui/map/MapsFragment.java - About 2 hrs to fix

    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 getDeviceLocation has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Wontfix

        private void getDeviceLocation() {
            /*
             * Get the best and most recent location of the device, which may be null in rare
             * cases when a location is not available.
             */
    Severity: Minor
    Found in app/src/main/java/ch/epfl/culturequest/ui/map/MapsFragment.java - About 1 hr to fix

      Method getMarkers has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Wontfix

          private void getMarkers(LatLng latestLocation) {
              CompletableFuture<List<OTMLocation>> places;
              float distance[] = new float[1];
              if (viewModel.getCenterOfLocations() == null) {
                  viewModel.setCenterOfLocations(latestLocation); // Just put a default value, this should only happen at the beginning
      Severity: Minor
      Found in app/src/main/java/ch/epfl/culturequest/ui/map/MapsFragment.java - About 1 hr to fix

        There are no issues that match your filters.

        Category
        Status