MrZaiko/Polysmee

View on GitHub

Showing 22 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;

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                              removeButton.setOnClickListener(l -> {
                                  bans.remove(name);
                                  dataPasser.dataPass(bans, AppointmentActivity.BANS);
                      
                                  if (mode == AppointmentActivity.DETAIL_MODE) {
                      app/src/main/java/io/github/polysmee/appointments/fragments/AppointmentCreationAddUserFragment.java on lines 228..238

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 70.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                              removeButton.setOnClickListener(l -> {
                                  invites.remove(userName);
                                  dataPasser.dataPass(invites, AppointmentActivity.INVITES);
                      
                                  if (mode == AppointmentActivity.DETAIL_MODE) {
                      app/src/main/java/io/github/polysmee/appointments/fragments/AppointmentCreationBanUserFragment.java on lines 202..212

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 70.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      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

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          protected void setListenerUserAppointments() {
                              if (userAppointmentsListener != null) {
                                  user.removeAppointmentsListener(userAppointmentsListener);
                              }
                      
                      
                      app/src/main/java/io/github/polysmee/invites/fragments/AppointmentsInvitesFragment.java on lines 176..184

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 53.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      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
                          Severity
                          Category
                          Status
                          Source
                          Language