Showing 436 of 436 total issues
Method addAttentionFlagsService
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected void addAttentionFlagsService() {
try {
JSONObject jsonObject = new JSONObject(AncLibrary.getInstance().getDetailsRepository().getAllDetailsForClient(pc.getCaseId()).get(ConstantsUtils.DetailsKeyUtils.ATTENTION_FLAG_FACTS));
Facts facts = new Facts();
- 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 saveRegistration
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private void saveRegistration(Pair<Client, Event> pair, String jsonString, boolean isEditMode) {
try {
Client baseClient = pair.first;
Event baseEvent = pair.second;
- 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
ContactWizardJsonFormFragment
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
public class ContactWizardJsonFormFragment extends JsonWizardFormFragment {
public static final String TAG = ContactWizardJsonFormFragment.class.getName();
private static final int MENU_NAVIGATION = 100001;
private boolean savePartial = false;
private TextView contactTitle;
ProfileTasksFragment
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
public class ProfileTasksFragment extends BaseProfileFragment implements ProfileFragmentContract.View {
private final ANCFormUtils formUtils = new ANCFormUtils();
private Button dueButton;
private ButtonAlertStatus buttonAlertStatus;
private ProfileFragmentContract.Presenter presenter;
Method compareItemAndValueGlobal
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private static boolean compareItemAndValueGlobal(String itemValue, String globalValue) {
if (!TextUtils.isEmpty(itemValue) && !TextUtils.isEmpty(globalValue)) {
List<String> globalValuesList = new ArrayList<>();
if (globalValue.startsWith("[")) {
String[] globalValuesArray = globalValue.substring(1, globalValue.length() - 1).split(", ");
- 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 finalizeContactForm
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
@Override
public HashMap<String, String> finalizeContactForm(final Map<String, String> details, Context context) {
if (details != null) {
try {
String referral = details.get(ConstantsUtils.REFERRAL);
- 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 checkBoxWriteValue
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected void checkBoxWriteValue(String stepName, String parentKey, String childObjectKey, String childKey,
String value, boolean popup) throws JSONException {
synchronized (getmJSONObject()) {
JSONObject jsonObject = getmJSONObject().getJSONObject(stepName);
- 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 createMatrixCursor
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public AdvancedMatrixCursor createMatrixCursor(Response<String> response) {
String[] columns = new String[]{"_id", "relationalid", DBConstantsUtils.KeyUtils.FIRST_NAME, DBConstantsUtils.KeyUtils.LAST_NAME,
DBConstantsUtils.KeyUtils.DOB,DBConstantsUtils.KeyUtils.EDD, DBConstantsUtils.KeyUtils.ANC_ID, DBConstantsUtils.KeyUtils.PHONE_NUMBER, DBConstantsUtils.KeyUtils.ALT_NAME,DBConstantsUtils.KeyUtils.NEXT_CONTACT,DBConstantsUtils.KeyUtils.NEXT_CONTACT_DATE};
AdvancedMatrixCursor matrixCursor = new AdvancedMatrixCursor(columns);
Identical blocks of code found in 2 locations. 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
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 132.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. 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
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 132.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static void launchSiteCharacteristicsForm(Activity activity) {
try {
Intent intent = new Intent(activity, FormConfigurationJsonFormActivity.class);
JSONObject form = new com.vijay.jsonwizard.utils.FormUtils().getFormJsonFromRepositoryOrAssets(activity.getApplicationContext(), ConstantsUtils.JsonFormUtils.ANC_SITE_CHARACTERISTICS);
if (form != null) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 128.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static void launchANCCloseForm(Activity activity) {
try {
Intent intent = new Intent(activity, FormConfigurationJsonFormActivity.class);
JSONObject form = new com.vijay.jsonwizard.utils.FormUtils().getFormJsonFromRepositoryOrAssets(activity.getApplicationContext(), ConstantsUtils.JsonFormUtils.ANC_CLOSE);
if (form != null) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 128.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method proceedToContact
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void proceedToContact(String baseEntityId, HashMap<String, String> personObjectClient, Context context) {
try {
Intent intent = new Intent(context.getApplicationContext(), ContactJsonFormActivity.class);
Contact quickCheck = new Contact();
Method fetchUpcomingContacts
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void fetchUpcomingContacts(final String entityId, final String referralContactNo,
final ContactSummarySendContract.InteractorCallback callback) {
Runnable runnable = () -> {
Method onResumption
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected void onResumption() {
try {
fetchContactAndAlertStatus();
yamlConfigListGlobal = new ArrayList<>(); //This makes sure no data duplication happens
- 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 updateLocationTree
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static void updateLocationTree(@NonNull JSONArray fields,
@NonNull String defaultLocationString,
@NonNull String defaultFacilityString,
@NonNull String entireTreeString) {
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 onActivityResult
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == AllConstants.BARCODE.BARCODE_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
if (data != null) {
Barcode barcode = data.getParcelableExtra(AllConstants.BARCODE.BARCODE_KEY);
- 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 updateStatusIcon
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private void updateStatusIcon(JSONObject taskValue, ContactTasksViewHolder contactTasksViewHolder) {
try {
if (taskValue.has(JsonFormConstants.VALUE)) {
JSONArray values = taskValue.getJSONArray(JsonFormConstants.VALUE);
for (int i = 0; i < values.length(); 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"
Further reading
Method process
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public void process() throws Exception {
//Get actual Data
JSONObject object;
List<PartialContact> partialContacts = getPartialContactRepository()
- 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 loadPreviousContactsDetails
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void loadPreviousContactsDetails(Map<String, List<Facts>> allContactFacts) throws IOException, ParseException {
List<LastContactDetailsWrapper> lastContactDetailsWrapperList = new ArrayList<>();
if (!allContactFacts.isEmpty()) {
for (Map.Entry<String, List<Facts>> entry : allContactFacts.entrySet()) {