movemeet/movemeet

View on GitHub

Showing 53 of 53 total issues

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

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @androidx.annotation.Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == REQUEST_IMAGE) {
            if (resultCode == android.app.Activity.RESULT_OK) {
app/src/main/java/com/sdp/movemeet/view/activity/ActivityDescriptionActivity.java on lines 486..497

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 84.

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

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @androidx.annotation.Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == REQUEST_IMAGE) {
            if (resultCode == android.app.Activity.RESULT_OK) {
app/src/main/java/com/sdp/movemeet/view/profile/EditProfileActivity.java on lines 140..151

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 84.

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

    private void loadActivityHeaderPicture() {
        activityImage = findViewById(R.id.activity_image_description);
        progressBar = findViewById(R.id.progress_bar_activity_description);
        imagePath = activity.getDocumentPath() + ImageHandler.PATH_SEPARATOR + ImageHandler.ACTIVITY_IMAGE_NAME;
        Image image = new Image(null, activityImage);
app/src/main/java/com/sdp/movemeet/view/activity/ActivityDescriptionActivity.java on lines 460..467

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 83.

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

    private void loadActivityHeaderPicture() {
        activityImage = findViewById(R.id.activity_image_description);
        progressBar = findViewById(R.id.progress_bar_activity_description);
        imagePath = activity.getDocumentPath() + ImageHandler.PATH_SEPARATOR + ImageHandler.ACTIVITY_IMAGE_NAME;
        Image image = new Image(null, activityImage);
app/src/main/java/com/sdp/movemeet/view/activity/ActivityDescriptionActivityUnregister.java on lines 127..134

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 83.

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

    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
    public void unregisterFromActivityImplementation(Activity activity, String userId, String organizerId) {
        if (activity.getParticipantId().contains(userId)) {
            if (!userId.equals(organizerId)) {
                try {

    Method deserialize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @RequiresApi(api = Build.VERSION_CODES.N)
        public Activity deserialize(Map<String, Object> data) {
    
            Activity act = new Activity(
                    (String) data.get(ACTIVITY_KEY),

      Method onNavigationItemSelected has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private boolean onNavigationItemSelected(MenuItem menuItem) {
              if (menuItem.getItemId() != this.activityId) {
                  switch (menuItem.getItemId()) {
                      case R.id.nav_home:
                          Navigation.goToHome(navigationView);
      Severity: Minor
      Found in app/src/main/java/com/sdp/movemeet/view/navigation/Navigation.java - About 1 hr to fix

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

            @Override
            protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_upload_activity);
        
        

          Method onCreateView has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @RequiresApi(api = Build.VERSION_CODES.N)
              public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          
                  View view = inflater.inflate(R.layout.fragment_map, container, false);
          
          
          Severity: Minor
          Found in app/src/main/java/com/sdp/movemeet/view/map/MainMapFragment.java - About 1 hr to fix

            Method onCreate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                protected void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.activity_chat);
            
            
            Severity: Minor
            Found in app/src/main/java/com/sdp/movemeet/view/chat/ChatActivity.java - About 1 hr to fix

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

                  public void deleteUserAccountCall(View view) {
                      AlertDialog.Builder builder = new AlertDialog.Builder(this);
                      builder.setTitle("Delete account");
                      builder.setMessage("Are you sure you want to delete your account?");
                      builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
              app/src/main/java/com/sdp/movemeet/view/main/MainActivity.java on lines 42..57

              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 67.

              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

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

                  @Override
                  public void onBackPressed() {
                      AlertDialog.Builder builder = new AlertDialog.Builder(this);
                      builder.setTitle("Exit");
                      builder.setMessage("Confirm exit ?");
              Severity: Minor
              Found in app/src/main/java/com/sdp/movemeet/view/main/MainActivity.java and 1 other location - About 55 mins to fix
              app/src/main/java/com/sdp/movemeet/view/profile/EditProfileActivity.java on lines 196..210

              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 67.

              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

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

                      return "FullName:" + fullName + "\nEmail:" + email + "\nId:" + idUser +
                              "\nPhone:" + phone + "\nImageId:" + imageId + "\nDescription:" + description +
                              "\nCreatedActivitiesId" + createdActivitiesId + "\nRegisteredActivitiesId" + registeredActivitiesId;
              Severity: Minor
              Found in app/src/main/java/com/sdp/movemeet/models/User.java and 1 other location - About 50 mins to fix
              app/src/main/java/com/sdp/movemeet/models/Activity.java on lines 328..329

              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 62.

              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

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

                      return "ActivityId:" + activityId + "\nOrganizerId" + organizerId + "\nTitle:" + title + "\nNumberParticipant:" + numberParticipant +
                              "\nParticipantId:" + participantsId + "\nLongitude:" + longitude + "\nLatitude:" + latitude + "\nDescription:" + description +
              Severity: Minor
              Found in app/src/main/java/com/sdp/movemeet/models/Activity.java and 1 other location - About 50 mins to fix
              app/src/main/java/com/sdp/movemeet/models/User.java on lines 240..242

              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 62.

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

                  private static ProgressBar getProgressBar(Activity activity) {
                      ProgressBar progressBar = null;
                      if (activity instanceof ActivityDescriptionActivity)
                          progressBar = ((ActivityDescriptionActivity) activity).getProgressBar();
                      else if (activity instanceof ActivityDescriptionActivityUnregister)
              Severity: Minor
              Found in app/src/main/java/com/sdp/movemeet/utility/ImageHandler.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 unregisterFromActivityImplementation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
                  public void unregisterFromActivityImplementation(Activity activity, String userId, String organizerId) {
                      if (activity.getParticipantId().contains(userId)) {
                          if (!userId.equals(organizerId)) {
                              try {

              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 3 locations. Consider refactoring.
              Open

                              if (modelList.get(position).getTitle().equals("Workout #2: Legs")) {
                                  //start NewActivity with title for actionbar and text for textview
                                  Intent intent = new Intent(context, TextWorkoutActivity.class);
                                  intent.putExtra("contentTv", "\n• 4x5 Barbell Squats\n• 4x25 Barbell Hip Thrust\n• 4x15 Leg Extension\n• 4x20 Standing Calf Raises\n");
                                  context.startActivity(intent);
              app/src/main/java/com/sdp/movemeet/view/workout/ListViewAdapter.java on lines 75..80
              app/src/main/java/com/sdp/movemeet/view/workout/ListViewAdapter.java on lines 87..92

              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 46.

              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

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

                              if (modelList.get(position).getTitle().equals("Workout #3: Upper Body")) {
                                  //start NewActivity with title for actionbar and text for textview
                                  Intent intent = new Intent(context, TextWorkoutActivity.class);
                                  intent.putExtra("contentTv", "\n• 4x15 Bench Presses\n• 4x25 Overhead Presses\n• 4x15 Barbell Split Squats\n• 4x20 Back Squats\n");
                                  context.startActivity(intent);
              app/src/main/java/com/sdp/movemeet/view/workout/ListViewAdapter.java on lines 75..80
              app/src/main/java/com/sdp/movemeet/view/workout/ListViewAdapter.java on lines 81..86

              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 46.

              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

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

                              if (modelList.get(position).getTitle().equals("Workout #1: Abs")) {
                                  //start NewActivity with title for actionbar and text for textview
                                  Intent intent = new Intent(context, TextWorkoutActivity.class);
                                  intent.putExtra("contentTv", "\n• 3x15 Leg crunches\n• 3x10 Dumbbell Crunches\n• 3x6 Leg Raises\n• 3x15 Hanging Knee Raises\n");
                                  context.startActivity(intent);
              app/src/main/java/com/sdp/movemeet/view/workout/ListViewAdapter.java on lines 81..86
              app/src/main/java/com/sdp/movemeet/view/workout/ListViewAdapter.java on lines 87..92

              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 46.

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

                  @Override
                  public boolean onMarkerClick(final Marker marker) {
                      //If user accidently touches the marker instead of the infowindow, act like he clicked on the infowindow
                      if (marker.getTag().equals("new activity position")) onInfoWindowClick(marker);
                      else if (!marker.getTag().equals("my position")) {
              Severity: Minor
              Found in app/src/main/java/com/sdp/movemeet/view/map/MainMapFragment.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

              Severity
              Category
              Status
              Source
              Language