nheyek/SDP-2018

View on GitHub
app/src/main/java/ch/epfl/sweng/studyup/player/Player.java

Summary

Maintainability
C
1 day
Test Coverage

Player has 47 methods (exceeds 20 allowed). Consider refactoring.
Open

public class Player implements SpecialQuestObservable {

    private static final String TAG = Player.class.getSimpleName();

    private static Player instance = null;
Severity: Minor
Found in app/src/main/java/ch/epfl/sweng/studyup/player/Player.java - About 6 hrs to fix

    File Player.java has 335 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package ch.epfl.sweng.studyup.player;
    
    import android.app.Activity;
    import android.util.Log;
    
    
    Severity: Minor
    Found in app/src/main/java/ch/epfl/sweng/studyup/player/Player.java - About 4 hrs to fix

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

          @SuppressWarnings("unchecked")
          public void updateLocalDataFromRemote(Map<String, Object> remotePlayerData) {
      
              if (remotePlayerData.isEmpty()) {
                  Log.e(TAG,"Unable to retrieve player data from Firebase.");
      Severity: Minor
      Found in app/src/main/java/ch/epfl/sweng/studyup/player/Player.java - About 1 hr to fix

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

            public void setCourses(List<Course> courses) {
                if(isStudent()) {
                    this.coursesEnrolled = new ArrayList<>(courses);
                } else {
                    List<Course> oldCourses = getCoursesTeached();
        Severity: Minor
        Found in app/src/main/java/ch/epfl/sweng/studyup/player/Player.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