OpenSRP/opensrp-client-anc

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

Summary

Maintainability
C
1 day
Test Coverage

AncLibrary has 36 methods (exceeds 20 allowed). Consider refactoring.
Open

public class AncLibrary {
    private static AncLibrary instance;
    private final Context context;
    private final JsonSpecHelper jsonSpecHelper;
    private PartialContactRepository partialContactRepository;

    File AncLibrary.java has 296 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package org.smartregister.anc.library;
    
    import androidx.annotation.NonNull;
    import androidx.annotation.Nullable;
    
    

      Method populateGlobalSettingsCore has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          private void populateGlobalSettingsCore(Setting setting) {
              try {
                  JSONObject settingObject = setting != null ? new JSONObject(setting.getValue()) : null;
                  if (settingObject != null) {
                      JSONArray settingArray = settingObject.getJSONArray(AllConstants.SETTINGS);

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

          public static void init(@NonNull Context context, int dbVersion, @NonNull ActivityConfiguration activityConfiguration, @Nullable SubscriberInfoIndex subscriberInfoIndex, @Nullable RegisterQueryProvider registerQueryProvider, @Nullable AncMetadata metadata) {
      Severity: Minor
      Found in opensrp-anc/src/main/java/org/smartregister/anc/library/AncLibrary.java - About 45 mins to fix

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

            public static void init(@NonNull Context context, int dbVersion, @NonNull ActivityConfiguration activityConfiguration, @Nullable SubscriberInfoIndex subscriberInfoIndex, @Nullable RegisterQueryProvider registerQueryProvider) {
        Severity: Minor
        Found in opensrp-anc/src/main/java/org/smartregister/anc/library/AncLibrary.java - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status