OpenSRP/opensrp-client-anc

View on GitHub

Showing 306 of 436 total issues

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

    @Override
    public void onBindViewHolder(@NonNull ViewHolder viewHolder, int position) {
        if (lastContactDetailsList.size() > 0) {
            LastContactDetailsWrapper lastContactDetails = lastContactDetailsList.get(position);
            Facts facts = lastContactDetails.getFacts();

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

        @Override
        public void loadPreviousContactSchedule(String baseEntityId, String contactNo, String edd) {
            try {
                Facts immediatePreviousSchedule = getPreviousContactRepository()
                        .getImmediatePreviousSchedule(baseEntityId, contactNo);

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

          @SuppressLint("NewApi")
          static String cleanValue(String value) {
              String returnValue = "";
              try {
                  if (value.trim().length() > 0 && value.trim().charAt(0) == '[') {

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

            public static JSONObject getFormAsJson(JSONObject form, String formName, String id, String currentLocationId)
                    throws Exception {
                if (form == null) {
                    return null;
                }

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

                  @Override
                  public void onBindViewHolder(ViewHolder holder, int position) {
                      Field field = filterList.get(position);
                      holder.checkedTextView.setText(field.getDisplayName());
                      holder.checkedTextView.setTag(field);

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

                public List<Task> getOpenTasks(String baseEntityId) {
                    String orderBy = ID + " DESC ";
                    Cursor mCursor = null;
                    String selection = "";
                    String[] selectionArgs = new String[]{};

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

                  private JSONObject removeDueTests(JSONObject formObject, List<Task> taskList) {
                      JSONObject form = new JSONObject();
                      try {
                          Map<String, JSONObject> keys = taskHashMap(taskList);
                          if (formObject != null && taskList != null && taskList.size() > 0 && formObject.has(JsonFormConstants.STEP1)) {

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

                    public PartialContact getPartialContact(PartialContact partialContact) {
                        String selection = null;
                        String[] selectionArgs = null;
                        PartialContact dbPartialContact = null;
                        Cursor mCursor = null;

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

                      private void preProcessDefaultValues(JSONObject object) {
                          try {
                              if (object != null) {
                                  Iterator<String> keys = object.keys();
                  
                  

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

                        public List<Task> getClosedTasks(String baseEntityId) {
                            String orderBy = ID + " DESC ";
                            Cursor mCursor = null;
                            String selection = "";
                            String[] selectionArgs = new String[]{};

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

                          @Override
                          public void processEventClient(@NonNull EventClient eventClient, @NonNull List<Event> unsyncEvents, @Nullable ClientClassification clientClassification) throws Exception {
                              Event event = eventClient.getEvent();
                              if (event == null) {
                                  return;

                        Consider simplifying this complex logical expression.
                        Open

                                if (!TextUtils.isEmpty(ancId.getText()) || !TextUtils.isEmpty(firstName.getText()) ||
                                        !TextUtils.isEmpty(lastName.getText()) || !TextUtils.isEmpty(edd.getText()) ||
                                        !TextUtils.isEmpty(dob.getText()) || !TextUtils.isEmpty(phoneNumber.getText()) ||
                                        !TextUtils.isEmpty(altContactName.getText())) {
                                    search.setEnabled(true);

                          Method search has 8 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public void search(String firstName, String lastName, String ancId, String edd, String dob, String phoneNumber,
                                                 String alternateContact, boolean isLocal) {

                            Method createEditMap has 8 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                public Map<String, String> createEditMap(String firstName, String lastName, String ancId, String edd, String dob,
                                                                         String phoneNumber, String alternateContact, boolean isLocal) {

                              Method createEditMap has 8 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                      Map<String, String> createEditMap(String firstName, String lastName, String ancId, String edd, String dob,
                                                                        String phoneNumber, String alternateContact, boolean isLocal);

                                Method search has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                        void search(String firstName, String lastName, String ancId, String edd, String dob, String phoneNumber,
                                                    String alternateContact, boolean isLocal);

                                  Method onViewClicked has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      @Override
                                      protected void onViewClicked(View view) {
                                          int viewId = view.getId();
                                          if (viewId == R.id.logout_section) {
                                              DrishtiApplication.getInstance().logoutCurrentUser();

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

                                      @Override
                                      public void loadPreviousContactSchedule(String baseEntityId, String contactNo, String edd) {
                                          try {
                                              Facts immediatePreviousSchedule = getPreviousContactRepository()
                                                      .getImmediatePreviousSchedule(baseEntityId, contactNo);

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

                                      @Override
                                      public void refreshProfileTopSection(Map<String, String> client) {
                                          if (client != null) {
                                              getProfileView()
                                                      .setProfileName(client.get(DBConstantsUtils.KeyUtils.FIRST_NAME) + " " + client.get(DBConstantsUtils.KeyUtils.LAST_NAME));

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

                                      protected void performLocationSpinnerAction(AdapterView<?> parent, int position) {
                                          String key = (String) parent.getTag(R.id.key);
                                          String isHumanAction = String.valueOf(parent.getTag(R.id.is_human_action));
                                  
                                          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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language