opensrp-anc/src/main/java/org/smartregister/anc/library/AncLibrary.java
AncLibrary
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
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
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
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);
- Read upRead up
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
Open
public static void init(@NonNull Context context, int dbVersion, @NonNull ActivityConfiguration activityConfiguration, @Nullable SubscriberInfoIndex subscriberInfoIndex, @Nullable RegisterQueryProvider registerQueryProvider, @Nullable AncMetadata metadata) {
Method init
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static void init(@NonNull Context context, int dbVersion, @NonNull ActivityConfiguration activityConfiguration, @Nullable SubscriberInfoIndex subscriberInfoIndex, @Nullable RegisterQueryProvider registerQueryProvider) {