basbeu/theSofties

View on GitHub
app/src/main/java/ch/epfl/sweng/favors/favors/FavorDetailView.java

Summary

Maintainability
A
0 mins
Test Coverage

File FavorDetailView.java has 308 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

package ch.epfl.sweng.favors.favors;

import android.arch.lifecycle.ViewModelProviders;
import android.databinding.BindingAdapter;
import android.databinding.DataBindingUtil;
Severity: Minor
Found in app/src/main/java/ch/epfl/sweng/favors/favors/FavorDetailView.java - About 3 hrs to fix

    Method onCreateView has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Wontfix

        @Override
        public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            binding = DataBindingUtil.inflate(inflater, R.layout.fragment_favor_detail_view, container, false);
            binding.setElements(this);
    Severity: Major
    Found in app/src/main/java/ch/epfl/sweng/favors/favors/FavorDetailView.java - About 2 hrs to fix

      Method onComplete has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Wontfix

              @Override
              public void onComplete(@NonNull Task task) {
                  if (interestedPeople.contains(User.getMain().getId())) {
                      sendMessage(localFavor.get(Favor.StringFields.ownerID), "Sorry, I'm not anymore interested in your favor : " + localFavor.get(Favor.StringFields.title));
                      interestedPeople.remove(User.getMain().getId());
      Severity: Minor
      Found in app/src/main/java/ch/epfl/sweng/favors/favors/FavorDetailView.java - About 1 hr to fix

        Method paySelectedPeople has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Wontfix

            public void paySelectedPeople(ArrayList<String> selectedUsers) {
        
                long tokenPerPerson = localFavor.get(Favor.LongFields.tokenPerPerson);
        
                if (selectedUsers.size() == 0) {
        Severity: Minor
        Found in app/src/main/java/ch/epfl/sweng/favors/favors/FavorDetailView.java - About 1 hr to fix

          Method updateInterestedUsersNames has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Wontfix

              private void updateInterestedUsersNames(Favor favor){
                  if (favor.get(Favor.ObjectFields.interested) != null && favor.get(Favor.ObjectFields.interested) instanceof ArrayList) {
                      interestedPeople = (ArrayList<String>) favor.get(Favor.ObjectFields.interested);
                      userNames = new HashMap<>();
                      //TODO: favor.getRef(Favor.ObjectFields.interested) and set a listener;
          Severity: Minor
          Found in app/src/main/java/ch/epfl/sweng/favors/favors/FavorDetailView.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 onCreate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Wontfix

              @Override
              public void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  userNames = new HashMap<>();
          
          
          Severity: Minor
          Found in app/src/main/java/ch/epfl/sweng/favors/favors/FavorDetailView.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 paySelectedPeople has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Wontfix

              public void paySelectedPeople(ArrayList<String> selectedUsers) {
          
                  long tokenPerPerson = localFavor.get(Favor.LongFields.tokenPerPerson);
          
                  if (selectedUsers.size() == 0) {
          Severity: Minor
          Found in app/src/main/java/ch/epfl/sweng/favors/favors/FavorDetailView.java - About 35 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

          Avoid too many return statements within this method.
          Wontfix

                  return binding.getRoot();
          Severity: Major
          Found in app/src/main/java/ch/epfl/sweng/favors/favors/FavorDetailView.java - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status