SDPepe/AppArt

View on GitHub

Showing 23 of 101 total issues

File FirestoreAdHelper.java has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package ch.epfl.sdp.appart.database.firestoreservicehelpers;

import android.net.Uri;
import android.util.Log;
import android.util.Pair;

    AppUser has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class AppUser implements User {
    
        /* user attributes */
        private final String userId;
        private String name;
    Severity: Minor
    Found in app/src/main/java/ch/epfl/sdp/appart/user/AppUser.java - About 2 hrs to fix

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

          @Override
          public void onBindViewHolder(@NonNull PlaceViewHolder holder,
                                       int position) {
              Pair<PlaceOfInterest, Float> placeAndDistance = places.get(position);
              PlaceOfInterest place = placeAndDistance.first;
      Severity: Major
      Found in app/src/main/java/ch/epfl/sdp/appart/place/PlaceAdapter.java - About 2 hrs to fix

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

            @Override
            protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_scrolling);
                AlertDialog.Builder builder = new AlertDialog.Builder(this);
        Severity: Major
        Found in app/src/main/java/ch/epfl/sdp/appart/ScrollingActivity.java - About 2 hrs to fix

          Method getResult has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private void getResult(CompletableFuture<String> rawResult,
                                     CompletableFuture<List<PlaceOfInterest>> result) {
                  //parse the Json String to a JSONArray to work with
                  CompletableFuture<JSONArray> queriesResults =
                          rawResult.thenCompose(this::parseRawResults);
          Severity: Minor
          Found in app/src/main/java/ch/epfl/sdp/appart/place/PlaceService.java - About 2 hrs to fix

            Method onBindViewHolder has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                @Override
                public void onBindViewHolder(@NonNull PlaceViewHolder holder,
                                             int position) {
                    Pair<PlaceOfInterest, Float> placeAndDistance = places.get(position);
                    PlaceOfInterest place = placeAndDistance.first;
            Severity: Minor
            Found in app/src/main/java/ch/epfl/sdp/appart/place/PlaceAdapter.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 setupMap has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private void setupMap() {
                    SupportMapFragment mapFragment =
                            (SupportMapFragment) getSupportFragmentManager()
                                    .findFragmentById(R.id.map);
                    mapFragment.getView().setContentDescription("WAITING");
            Severity: Minor
            Found in app/src/main/java/ch/epfl/sdp/appart/MapActivity.java - About 1 hr to fix

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

                  private CompletableFuture<Void> removeStaleAds() {
              
                      if (!DatabaseSync.areWeOnline(this)) {
                          return CompletableFuture.completedFuture(null);
                      }
              Severity: Minor
              Found in app/src/main/java/ch/epfl/sdp/appart/FavoriteActivity.java - About 1 hr to fix

                Method getInfoContents has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @Override
                    public View getInfoContents(Marker marker) {
                        View v = activity.getLayoutInflater().inflate(R.layout.map_info_layout,
                                null);
                        TextView cityTextView =
                Severity: Minor
                Found in app/src/main/java/ch/epfl/sdp/appart/map/ApartmentInfoWindow.java - About 1 hr to fix

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

                      @Override
                      protected void onCreate(Bundle savedInstanceState) {
                          super.onCreate(savedInstanceState);
                          setContentView(R.layout.activity_announce);
                  
                  
                  Severity: Minor
                  Found in app/src/main/java/ch/epfl/sdp/appart/AdActivity.java - About 1 hr to fix

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

                        @NotNull
                        @NonNull
                        public CompletableFuture<Ad> getAd(String adId) {
                            CompletableFuture<Ad> result = new CompletableFuture<>();
                    
                    

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

                          private void loadImage() {
                              PLSphericalPanorama panorama = new PLSphericalPanorama();
                      
                              CompletableFuture<Bitmap> bitmapFuture = new CompletableFuture<>();
                              if(isLocal) {
                      Severity: Minor
                      Found in app/src/main/java/ch/epfl/sdp/appart/PanoramaActivity.java - About 1 hr to fix

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

                            private CompletableFuture<List<Pair<PlaceOfInterest, Float>>> computeDistances(CompletableFuture<List<PlaceOfInterest>> placesFuture, Location location) {
                                CompletableFuture<List<Pair<PlaceOfInterest, Float>>> result =
                                        new CompletableFuture<>();
                                placesFuture.thenAccept(placesOfInterests -> {
                        
                        
                        Severity: Minor
                        Found in app/src/main/java/ch/epfl/sdp/appart/place/PlaceService.java - About 1 hr to fix

                          Method updatePhotos has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private void updatePhotos(Pair<List<String>, Boolean> referencesAndIsLocal) {
                                  LinearLayout horizontalLayout =
                                          findViewById(R.id.horizontal_children_Ad_linearLayout);
                                  horizontalLayout.removeAllViews();
                                  List<String> references = referencesAndIsLocal.first;
                          Severity: Minor
                          Found in app/src/main/java/ch/epfl/sdp/appart/AdActivity.java - About 1 hr to fix

                            Method makeAddress has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public static Address makeAddress(String address) {
                            
                                    String filteredAddress = address.trim();
                                    String[] split = filteredAddress.split(",");
                                    Matcher streetMatcher = streetPattern.matcher(split[0].trim());

                              Method equals has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  @Override
                                  public boolean equals(Object o) {
                                      if (this == o) return true;
                                      if (o == null || getClass() != o.getClass()) return false;
                                      Address address = (Address) o;
                              Severity: Minor
                              Found in app/src/main/java/ch/epfl/sdp/appart/location/place/address/Address.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 uploadAdFromReferences has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  private CompletableFuture<Void> uploadAdFromReferences(Ad ad, DocumentReference adRef,
                                                             DocumentReference cardRef, StorageReference imagesRef,
                                                             List<String> picturesReferences, List<String> panoramasReferences) {

                                Method uploadCardFromReferences has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    private CompletableFuture<Void> uploadCardFromReferences(Ad ad, DocumentReference adRef,
                                                                 DocumentReference cardRef, StorageReference imagesRef,
                                                                 String firstImageRef) {

                                  Method onResourceReady has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                                          public boolean onResourceReady(Drawable resource,
                                                                                         Object model,
                                                                                         Target<Drawable> target,
                                                                                         DataSource dataSource,
                                                                                         boolean isFirstResource) {
                                  Severity: Minor
                                  Found in app/src/main/java/ch/epfl/sdp/appart/map/ApartmentInfoWindow.java - About 35 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                return null;
                                    Severity: Major
                                    Found in app/src/main/java/ch/epfl/sdp/appart/AdActivity.java - About 30 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language