OpenSRP/opensrp-client-anc

View on GitHub
opensrp-anc/src/main/java/org/smartregister/anc/library/model/AdvancedSearchModel.java

Summary

Maintainability
B
4 hrs
Test Coverage

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

        public String createSearchString(String firstName, String lastName, String ancId, String edd, String dob,
                                         String phoneNumber, String alternateContact) {

      Method addMapValuesCheckingLocals has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private void addMapValuesCheckingLocals(String field, boolean isLocal, Map<String, String> editMap, String key, String globalField, String keyToMapTo) {

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

            private void addMapValues(String field, boolean isLocal, Map<String, String> editMap, String key, String globalField) {

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

              @Override
              public String createSearchString(String firstName, String lastName, String ancId, String edd, String dob,
                                               String phoneNumber, String alternateContact) {
                  String searchCriteria = "";
          
          

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

              @Override
              public String getMainConditionString(Map<String, String> editMap) {
          
                  String mainConditionString = "";
                  if (editMap == null || editMap.isEmpty()) {

          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