OpenSRP/opensrp-client-anc

View on GitHub
opensrp-anc/src/main/java/org/smartregister/anc/library/activity/ProfileActivity.java

Summary

Maintainability
C
1 day
Test Coverage

ProfileActivity has 38 methods (exceeds 20 allowed). Consider refactoring.
Open

public class ProfileActivity extends BaseProfileActivity implements ProfileContract.View {
    public static final String CLOSE_ANC_RECORD = "Close ANC Record";
    private TextView nameView;
    private TextView ageView;
    private TextView gestationAgeView;

    File ProfileActivity.java has 329 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package org.smartregister.anc.library.activity;
    
    import android.Manifest;
    import android.app.Activity;
    import android.app.AlertDialog;

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

          @Override
          protected void onActivityResult(int requestCode, int resultCode, Intent data) {
              //super.onActivityResult(requestCode, resultCode, data);
              AllSharedPreferences allSharedPreferences = AncLibrary.getInstance().getContext().allSharedPreferences();
              if (requestCode == ANCJsonFormUtils.REQUEST_CODE_GET_JSON && resultCode == Activity.RESULT_OK) {

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

          @Override
          public boolean onOptionsItemSelected(final MenuItem item) {
              int itemId = item.getItemId();
              // When user click home menu item then quit this activity.
              if (itemId == android.R.id.home) {

      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