CoronaTeam/CoronaGame

View on GitHub

Showing 21 of 43 total issues

File ConcreteAnalysisTest.java has 440 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package ch.epfl.sdp.contamination;

import android.location.Location;

import androidx.test.espresso.intent.Intents;

    File MapFragment.java has 432 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package ch.epfl.sdp.map.fragment;
    
    import android.annotation.SuppressLint;
    import android.content.ComponentName;
    import android.content.Context;
    Severity: Minor
    Found in app/src/main/java/ch/epfl/sdp/map/fragment/MapFragment.java - About 6 hrs to fix

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

      public class MapFragment extends Fragment implements LocationListener, RapidFloatingActionContentLabelList.OnRapidFloatingActionContentLabelListListener {
      
          // FIXME: some constant are dupicated from locationService
          private final static int LOCATION_PERMISSION_REQUEST = 20201;
          private static final int MIN_UP_INTERVAL_MILLISECS = 1000;
      Severity: Minor
      Found in app/src/main/java/ch/epfl/sdp/map/fragment/MapFragment.java - About 5 hrs to fix

        File PathsHandler.java has 336 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        package ch.epfl.sdp.map;
        
        import android.annotation.SuppressLint;
        import android.graphics.Color;
        import android.location.Location;
        Severity: Minor
        Found in app/src/main/java/ch/epfl/sdp/map/PathsHandler.java - About 4 hrs to fix

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

          public class UserInfectionFragment extends Fragment implements View.OnClickListener, Observer {
              private Button infectionStatusButton;
              private TextView infectionStatusView;
              private TextView onlineStatusView;
              private Button refreshButton;

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

            public class PathsHandler {
                public static final String YESTERDAY_INFECTED_LAYER_ID = "pointslayer-one";
                public static final String BEFORE_INFECTED_LAYER_ID = "pointslayer-two";
                public static final String YESTERDAY_PATH_LAYER_ID = "linelayer-one";
                public static final String BEFORE_PATH_LAYER_ID = "linelayer-two";
            Severity: Minor
            Found in app/src/main/java/ch/epfl/sdp/map/PathsHandler.java - About 2 hrs to fix

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

              public class PathHandlerTest {
              
                  @Rule
                  public final ActivityTestRule<MapActivity> activityRule = new ActivityTestRule<>(MapActivity.class);
                  private final int FOCUS_PATH_BUTTON_POSITION = 2;

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

                    private void initRouteCoordinates() {
                        routeCoordinates = new ArrayList<>();
                        routeCoordinates.add(Point.fromLngLat(-118.39439114221236, 33.397676454651766));
                        routeCoordinates.add(Point.fromLngLat(-118.39421054012902, 33.39769799454838));
                        routeCoordinates.add(Point.fromLngLat(-118.39408583869053, 33.39761901490136));
                Severity: Major
                Found in app/src/androidTest/java/ch/epfl/sdp/DataForDemo.java - About 2 hrs to fix

                  File DataForDemo.java has 254 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  package ch.epfl.sdp;
                  
                  import android.location.Location;
                  import android.util.Log;
                  
                  
                  Severity: Minor
                  Found in app/src/androidTest/java/ch/epfl/sdp/DataForDemo.java - About 2 hrs to fix

                    Method upload2GroupsFakeUsersLocations has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @Test
                        public void upload2GroupsFakeUsersLocations() {
                            // dense location forms a square of side 6
                            // dense location infected forms a square of side 4 (16 infected people and 20 healthy)
                            for (int i = 0; i < 6; ++i) {
                    Severity: Minor
                    Found in app/src/androidTest/java/ch/epfl/sdp/DataForDemo.java - About 1 hr to fix

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

                          @Nullable
                          @Override
                          public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
                              classPointer = this;
                      
                      
                      Severity: Minor
                      Found in app/src/main/java/ch/epfl/sdp/map/fragment/MapFragment.java - About 1 hr to fix

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

                            @Nullable
                            @Override
                            public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
                                super.onCreate(savedInstanceState);
                        
                        

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

                              @Test
                              public void decreaseSickProbabilityWhenRecovered() {
                                  recoveryCounter = 2;
                                  CityDataReceiver cityReceiver = new CityDataReceiver();
                                  ObservableCarrier me = new Layman(HEALTHY);

                            Method uploadBetterPath has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                @Test
                                public void uploadBetterPath() {
                                    ConcreteFirestoreInteractor cfi = new ConcreteFirestoreInteractor();
                                    initRouteCoordinates();
                                    initInfectedOnRoute();
                            Severity: Minor
                            Found in app/src/androidTest/java/ch/epfl/sdp/DataForDemo.java - About 1 hr to fix

                              Method askGPSPermission has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private void askGPSPermission() {
                                      connectivityBroker.requestPermissions(requireActivity(), LOCATION_PERMISSION_REQUEST);
                                      if (!connectivityBroker.hasPermissions(GPS)) {
                                          AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
                                          builder.setTitle(R.string.missing_GPS_Perm_Dialog_title)
                              Severity: Minor
                              Found in app/src/main/java/ch/epfl/sdp/map/fragment/MapFragment.java - About 1 hr to fix

                                Method uploadBunchOfUsersAtEPFL has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    @Test
                                    public void uploadBunchOfUsersAtEPFL() {
                                        Date rightNow = new Date(System.currentTimeMillis());
                                
                                
                                
                                Severity: Minor
                                Found in app/src/androidTest/java/ch/epfl/sdp/DataForDemo.java - About 1 hr 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 getUserNearbyDuring has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                        @Override
                                        public CompletableFuture<Map<Carrier, Integer>> getUserNearbyDuring(Location location, Date startDate, Date endDate) {
                                            if (location == null) {
                                                return CompletableFuture.completedFuture(Collections.emptyMap());
                                            } else {

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

                                    @Test
                                    public void upload2GroupsFakeUsersLocations() {
                                        // dense location forms a square of side 6
                                        // dense location infected forms a square of side 4 (16 infected people and 20 healthy)
                                        for (int i = 0; i < 6; ++i) {
                                Severity: Minor
                                Found in app/src/androidTest/java/ch/epfl/sdp/DataForDemo.java - About 45 mins 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 onClickChangeStatus has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private void onClickChangeStatus() {
                                        if (checkOnline()) {
                                            if (checkElapsedTimeSinceLastChange()) {
                                                if (Tools.canAuthenticate(requireActivity())) {
                                                    biometricPrompt.authenticate(promptInfo);

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

                                    private void startTimer() {
                                        class UpdatePosTask extends TimerTask {
                                            public void run() {
                                                if (isOnline && newestLocation != null) {
                                                    if (!IN_TEST) {

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language