MrZaiko/Polysmee

View on GitHub

Showing 19 of 148 total issues

DatabaseAppointment has 58 methods (exceeds 20 allowed). Consider refactoring.
Open

public class DatabaseAppointment implements Appointment {

    private final String id;

    public DatabaseAppointment(String id) {

    Appointment has 56 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public interface Appointment {
    
        /**
         * @return the id of this appointment, which defines equality
         */
    Severity: Major
    Found in app/src/main/java/io/github/polysmee/database/Appointment.java - About 1 day to fix

      File DatabaseAppointment.java has 437 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      package io.github.polysmee.database;
      
      import com.google.firebase.database.ValueEventListener;
      
      import io.github.polysmee.database.databaselisteners.childListeners.BooleanChildListener;

        File RoomActivityParticipantsFragment.java has 423 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        package io.github.polysmee.room.fragments;
        
        import android.Manifest;
        import android.app.Activity;
        import android.app.AlertDialog;

          Method initializeHandler has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              private void initializeHandler() {
          
                  handler = new IRtcEngineEventHandler() {
          
                      @Override
          Severity: Minor
          Found in app/src/main/java/io/github/polysmee/agora/video/Call.java - About 3 hrs 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

          AppointmentActivity has 24 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public class AppointmentActivity extends AppCompatActivity implements DataPasser {
          
              // Intents related attributes
              public static final String LAUNCH_MODE = "io.github.polysmee.appointments.AppointmentActivity.APPOINTMENT_ACTIVITY_LAUNCH_MODE";
              public static final String APPOINTMENT_ID = "io.github.polysmee.appointments.AppointmentActivity.APPOINTMENT_ACTIVITY_APPOINTMENT_ID";

            Method setUserOnline has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public void setUserOnline(boolean online, @NonNull String id) {
            
                    ConstraintLayout participantsLayout = participantsViews.get(id);
                    View muteButton = participantsLayout.findViewById(R.id.roomActivityParticipantElementMuteButton);
                    View videoButton = participantsLayout.findViewById(R.id.roomActivityParticipantElementVideoButton);

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

                  private void generateParticipantsView() {
                      LinearLayout layout = rootView.findViewById(R.id.roomActivityParticipantsLayout);
              
                      StringSetValueListener participantListener = p -> {
                          if(p.contains(mainUser.getId())) {

              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 initializeHandler has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private void initializeHandler() {
              
                      handler = new IRtcEngineEventHandler() {
              
                          @Override
              Severity: Minor
              Found in app/src/main/java/io/github/polysmee/agora/video/Call.java - About 1 hr to fix

                Method onAudioVolumeIndication has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                            @Override
                            public void onAudioVolumeIndication(AudioVolumeInfo[] speakers, int totalVolume) {
                
                                //Check the users who are currently talking and run the command to make them appear as talking
                                Set<Integer> newUsersInCall = new HashSet<Integer>();
                Severity: Minor
                Found in app/src/main/java/io/github/polysmee/agora/video/Call.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 listenersSetup has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private void listenersSetup() {
                
                        //Initialize listeners
                        LongValueListener startTimeListener = start -> {
                            Date startDate = new Date(start);

                  Method joinChannel has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private void joinChannel() {
                          if(InternetConnection.isOn()) {
                              if(!(ContextCompat.checkSelfPermission(getContext(), Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED)) {
                                  requestPermissionLauncher.launch(Manifest.permission.RECORD_AUDIO);
                                  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 doneButtonBehavior has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private void doneButtonBehavior(View view) {
                          boolean error = false;
                  
                          Calendar c = Calendar.getInstance();
                          c.set(Calendar.MONTH, c.get(Calendar.MONTH) - 1);

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

                        private void joinChannel() {
                            if(InternetConnection.isOn()) {
                                if(!(ContextCompat.checkSelfPermission(getContext(), Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED)) {
                                    requestPermissionLauncher.launch(Manifest.permission.RECORD_AUDIO);
                                    return;

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

                          private void refreshViews() {
                              LinearLayout layout = rootView.findViewById(R.id.roomActivityParticipantsLayout);
                              layout.removeAllViews();
                              String userId = mainUser.getId();
                              //add current user for it to appear first

                      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 createNewUserAppointment has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public String createNewUserAppointment(long start, long duration, String course, String name, boolean isPrivate) {
                      Severity: Minor
                      Found in app/src/main/java/io/github/polysmee/database/DatabaseUser.java - About 35 mins to fix

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

                            public static void fillUserList (Set<String> ids, List<String> allUsersNames, List<UserItemAutocomplete> allUsers, AutoCompleteTextView autoCompleteTextView, Context context) {

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

                              String createNewUserAppointment(long start, long duration, String course, String name, boolean isPrivate);
                          Severity: Minor
                          Found in app/src/main/java/io/github/polysmee/database/User.java - About 35 mins to fix

                            Method doneButtonBehavior has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private void doneButtonBehavior(View view) {
                                    boolean error = false;
                            
                                    Calendar c = Calendar.getInstance();
                                    c.set(Calendar.MONTH, c.get(Calendar.MONTH) - 1);

                            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