Showing 306 of 436 total issues
Method updateDefaultValues
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void updateDefaultValues(JSONArray stepArray, int i, JSONObject fieldObject) throws JSONException {
if (defaultValueFields.contains(fieldObject.getString(JsonFormConstants.KEY))) {
if (!fieldObject.has(JsonFormConstants.VALUE) ||
TextUtils.isEmpty(fieldObject.getString(JsonFormConstants.VALUE))) {
Method returnTranslatedStringJoinedValue
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressLint({"NewApi"})
public static String returnTranslatedStringJoinedValue(String value) {
try {
if (StringUtils.isNotBlank(value) && value.startsWith("[")) {
if (Utils.checkJsonArrayString(value)) {
Method saveRegistration
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void saveRegistration(Pair<Client, Event> pair, String jsonString, boolean isEditMode) {
try {
Client baseClient = pair.first;
Event baseEvent = pair.second;
Method processViewCustomizations
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void processViewCustomizations() {
try {
String jsonString =
getJsonViewFromPreference(ConstantsUtils.VIEW_CONFIGURATION_PREFIX + ConstantsUtils.ConfigurationUtils.LOGIN);
Method populatePatientColumn
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void populatePatientColumn(CommonPersonObjectClient pc, SmartRegisterClient client,
RegisterViewHolder viewHolder) {
String firstName = Utils.getValue(pc.getColumnmaps(), DBConstantsUtils.KeyUtils.FIRST_NAME, true);
String lastName = Utils.getValue(pc.getColumnmaps(), DBConstantsUtils.KeyUtils.LAST_NAME, true);
Method createSecondaryFormObject
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static JSONObject createSecondaryFormObject(JSONObject parentObject, JSONObject jsonSubForm, String encounterType)
throws JSONException {
Map<String, String> vMap = new HashMap<>();
JSONObject resultJsonObject = new JSONObject();
JSONObject stepJsonObject = new JSONObject();
- 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 processPopulatableFields
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected static void processPopulatableFields(Map<String, String> womanClient, JSONObject jsonObject)
throws JSONException {
AncMetadata ancMetadata = AncLibrary.getInstance().getAncMetadata();
- 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 getImmediatePreviousContact
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Facts getImmediatePreviousContact(Map<String, String> clientDetails, String baseEntityId, String contactNo) {
Facts facts = new Facts();
try {
facts = AncLibrary.getInstance().getPreviousContactRepository().getPreviousContactFacts(baseEntityId, contactNo, true);
- 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 onBindViewHolder
has a Cognitive Complexity of 13 (exceeds 5 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();
- 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 populateLocationSpinner
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private void populateLocationSpinner(JSONObject jsonObject, String parentLocationId, String spinnerKey,
List<String> controlsToHide) {
List<Location> locations = Utils.getLocationsByParentId(parentLocationId);
String selectedLocation = Utils.getCurrentLocation(spinnerKey, jsonFormView);
- 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 processRequiredStepsField
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void processRequiredStepsField(Facts facts, JSONObject object) throws Exception {
if (object != null) {
Iterator<String> keys = object.keys();
while (keys.hasNext()) {
String key = keys.next();
Method onResumption
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected void onResumption() {
try {
fetchContactAndAlertStatus();
yamlConfigListGlobal = new ArrayList<>(); //This makes sure no data duplication happens
Method removeWomanFromANCRegister
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void removeWomanFromANCRegister(final String closeFormJsonString, final String providerId) {
Runnable runnable = () -> {
try {
Triple<Boolean, Event, Event> triple = ANCJsonFormUtils
Method onClick
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void onClick(View view) {
try {
//To show current date in the datepicker
Calendar mcurrentDate = Calendar.getInstance();
Method initializeLastContactDetails
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void initializeLastContactDetails(HashMap<String, String> clientDetails) {
if (clientDetails != null) {
try {
List<LastContactDetailsWrapper> lastContactDetailsWrapperList = new ArrayList<>();
List<LastContactDetailsWrapper> lastContactDetailsTestsWrapperList = new ArrayList<>();
Method processCheckBoxSpecialWidget
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static void processCheckBoxSpecialWidget(JSONObject widget, List<String> keyList, List<String> valueList)
throws Exception {
//Clear previous selected values from the widget first
if (widget.has(JsonFormConstants.VALUE)) {
widget.remove(JsonFormConstants.VALUE);
Method saveImage
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void saveImage(String providerId, String entityId, String imageLocation) {
OutputStream outputStream = null;
try {
if (StringUtils.isBlank(imageLocation)) {
return;
Method getPreviousContactsFacts
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public List<PreviousContactsSummaryModel> getPreviousContactsFacts(String baseEntityId) {
List<PreviousContactsSummaryModel> previousContactFacts = new ArrayList<>();
Cursor factsCursor = null;
try {
SQLiteDatabase database = getWritableDatabase();
Method addTestsRuleObjects
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private List<YamlConfigWrapper> addTestsRuleObjects(Facts facts) throws IOException {
List<YamlConfigWrapper> lastContactTests = new ArrayList<>();
Iterable<Object> testsRuleObjects = AncLibrary.getInstance().readYaml(FilePathUtils.FileUtils.PROFILE_LAST_CONTACT_TEST);
for (Object ruleObject : testsRuleObjects) {
- 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 getListValuesAsString
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
@SuppressLint("NewApi")
public static String getListValuesAsString(List<String> list) {
List<String> returnList = new ArrayList<>();
if (list.size() != 0) {
for (int i = 0; i < list.size(); i++) {
- 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"