basbeu/theSofties

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

Summary

Maintainability
A
0 mins
Test Coverage

File FavorCreateFragment.java has 327 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

package ch.epfl.sweng.favors.favors;

import android.app.DatePickerDialog;
import android.arch.lifecycle.ViewModelProviders;
import android.content.Intent;

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

        @Nullable
        @Override
        public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState){
            binding = DataBindingUtil.inflate(inflater, R.layout.favors_layout,container,false);
            binding.setElements(this);

      Method createFavorIfValid has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Wontfix

          public void createFavorIfValid(Favor newFavor) {
              if (!allFavorFieldsValid()) {
                  return;
              }
      
      

        Method createFavorIfValid has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Wontfix

            public void createFavorIfValid(Favor newFavor) {
                if (!allFavorFieldsValid()) {
                    return;
                }
        
        

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

                @Override
                public void onPropertyChanged(Observable sender, int propertyId) {
                    if(propertyId != ObservableArrayList.ContentChangeType.Update.ordinal()){
                        return;
                    }
        Severity: Minor
        Found in app/src/main/java/ch/epfl/sweng/favors/favors/FavorCreateFragment.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

        Avoid too many return statements within this method.
        Wontfix

                return;
        Severity: Major
        Found in app/src/main/java/ch/epfl/sweng/favors/favors/FavorCreateFragment.java - About 30 mins to fix

          Method onActivityResult has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Wontfix

              @Override
              public void onActivityResult(int requestCode, int resultCode, Intent data) {
                  super.onActivityResult(requestCode, resultCode, data);
                  Bitmap bitmap = null;
                  if(resultCode == -1){
          Severity: Minor
          Found in app/src/main/java/ch/epfl/sweng/favors/favors/FavorCreateFragment.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

          There are no issues that match your filters.

          Category
          Status