MediaTo-SDP/MediaTo

View on GitHub

Showing 5 of 35 total issues

File SearchFragment.java has 289 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.github.sdp.mediato.ui;

import static com.github.sdp.mediato.data.UserDatabase.followUser;
import static com.github.sdp.mediato.data.UserDatabase.getAllUser;
import static com.github.sdp.mediato.data.UserDatabase.unfollowUser;
Severity: Minor
Found in app/src/main/java/com/github/sdp/mediato/ui/SearchFragment.java - About 2 hrs to fix

    File ReviewPostListAdapter.java has 272 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package com.github.sdp.mediato.utility.adapters;
    
    import android.content.Context;
    import android.text.Editable;
    import android.text.TextWatcher;

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

      public class SearchFragment extends Fragment implements View.OnClickListener, SearchView.OnQueryTextListener, UserAdapter.OnUserInteractionListener {
      
          private static String COLLECTION_NAME;
          private static String USERNAME;
          // Only one instance of the cache should be used
      Severity: Minor
      Found in app/src/main/java/com/github/sdp/mediato/ui/SearchFragment.java - About 2 hrs to fix

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

            @Override
            public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                     Bundle savedInstanceState) {
        
                // Inflate the layout for the search fragment
        Severity: Minor
        Found in app/src/main/java/com/github/sdp/mediato/ui/SearchFragment.java - About 1 hr to fix

          Method handlePhotoPickerResult has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private void handlePhotoPickerResult(int resultCode, Intent data) {
                  if (resultCode == Activity.RESULT_OK && data != null) {
                      profileImageUri = data.getData();
                      imageView.setImageURI(profileImageUri);
                      if (listener != null) {
          Severity: Minor
          Found in app/src/main/java/com/github/sdp/mediato/utility/PhotoPicker.java - About 25 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

          Severity
          Category
          Status
          Source
          Language