Showing 306 of 436 total issues
Avoid deeply nested control flow statements. Open
if (selectedValue.contains(JsonFormConstants.AncRadioButtonOptionTypesUtils.ORDERED) || selectedValue.contains(JsonFormConstants.AncRadioButtonOptionTypesUtils.NOT_DONE)) {
isComplete = false;
}
Avoid deeply nested control flow statements. Open
if (optionsToFilter == null) {
String itemKey = removeKeyPrefix(keyGlobal, ConstantsUtils.PREVIOUS);
newOptionsList.add(optionsMap.get(itemKey));
} else {
for (int itemIndex = 0; itemIndex < optionsToFilter.length(); itemIndex++) {
Avoid deeply nested control flow statements. Open
if (fieldObject.has(JsonFormConstants.CONTENT_FORM)) {
processRequiredStepsExpansionPanelValues(facts, fieldObject);
}
Avoid deeply nested control flow statements. Open
if (fieldObject.has(JsonFormConstants.IS_VISIBLE) && !fieldObject.getBoolean(JsonFormConstants.IS_VISIBLE)) {
isRequiredField = false;
}
Method onCreateLoader
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
final AdvancedMatrixCursor matrixCursor = ((RegisterFragmentPresenter) presenter).getMatrixCursor();
if (!globalQrSearch || matrixCursor == null) {
if (id == LOADER_ID) {
- 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
Avoid deeply nested control flow statements. Open
if (fieldObject.getString(JsonFormConstants.TYPE).equals(JsonFormConstants.EXPANSION_PANEL)) {
saveExpansionPanelPreviousValues(baseEntityId, fieldObject, contactNo);
continue;
}
Method getViewsFromJson
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public List<View> getViewsFromJson(String stepName, Context context, JsonFormFragment formFragment,
JSONObject jsonObject, CommonListener listener, boolean popup) throws Exception {
Avoid deeply nested control flow statements. Open
if (StringUtils.isNotBlank(formName) && formName.equals(ConstantsUtils.JsonFormUtils.ANC_QUICK_CHECK)) {
quickCheckDangerSignsSelectionHandler(fields);
}
Avoid deeply nested control flow statements. Open
for (Map.Entry<String, Object> stringObjectEntry : factObject.entrySet()) {
factsToUpdate.put(stringObjectEntry.getKey(), stringObjectEntry.getValue());
}
Method removeWomanFromANCRegister
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void removeWomanFromANCRegister(final String closeFormJsonString, final String providerId) {
Runnable runnable = () -> {
try {
Triple<Boolean, Event, Event> triple = ANCJsonFormUtils
- 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
Avoid deeply nested control flow statements. Open
if (StringUtils.isNotBlank(value)) {
factsToUpdate.put(key, value);
} else {
factsToUpdate.put(key, "");
}
Method getViewsFromJson
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
public List<View> getViewsFromJson(String stepName, Context context, JsonFormFragment formFragment,
JSONObject jsonObject, CommonListener listener, boolean popup) throws Exception {
this.formFragment = formFragment;
jsonFormView = (JsonFormActivity) formFragment.getActivity();
- 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
Avoid deeply nested control flow statements. Open
if (fieldObject.has(JsonFormConstants.VALUE) &&
!TextUtils.isEmpty(fieldObject.getString(JsonFormConstants.VALUE)) &&
!isCheckboxValueEmpty(fieldObject)) {
fieldObject.put(PreviousContactRepository.CONTACT_NO, contactNo);
Avoid deeply nested control flow statements. Open
if (keys.containsKey(fieldKey) && ANCJsonFormUtils.checkIfTaskIsComplete(keys.get(fieldKey))) {
fields.remove(i);
}
Avoid deeply nested control flow statements. Open
if (item != null && item.getBoolean(JsonFormConstants.VALUE)) {
if (item.getString(JsonFormConstants.KEY).equals(ConstantsUtils.DANGER_NONE)) {
none = true;
}
Avoid deeply nested control flow statements. Open
if (accordionObject.getString(JsonFormConstants.KEY).equals(accordion)) {
JSONArray value = accordionObject.optJSONArray(JsonFormConstants.VALUE);
if (value == null) {
return result;
}
Method addOtherRuleObjects
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private void addOtherRuleObjects(Facts facts) throws IOException {
Iterable<Object> ruleObjects = loadFile(FilePathUtils.FileUtils.PROFILE_LAST_CONTACT);
for (Object ruleObject : ruleObjects) {
List<YamlConfigWrapper> yamlConfigList = new ArrayList<>();
- 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 addOtherRuleObjects
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private void addOtherRuleObjects(Facts facts) throws IOException {
Iterable<Object> ruleObjects = loadFile(FilePathUtils.FileUtils.PROFILE_LAST_CONTACT);
for (Object ruleObject : ruleObjects) {
List<YamlConfigWrapper> yamlConfigList = new ArrayList<>();
- 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 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 onBindViewHolder
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
holder.sectionHeader.setText(processUnderscores(mData.get(position).getGroup()));
List<YamlConfigItem> fields = mData.get(position).getFields();
StringBuilder outputBuilder = new StringBuilder();
- 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"