Showing 436 of 436 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
protected void getProgressDialog() {
((ContactSummaryFinishActivity) context).showProgressDialog(R.string.please_wait_message);
((ContactSummaryFinishActivity) context).getProgressDialog().setMessage(
String.format(context.getString(R.string.finalizing_contact),
intent.getExtras().getInt(ConstantsUtils.IntentKeyUtils.CONTACT_NO)) + " data");
- 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 73.
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
@NotNull
private Task getTask(JSONObject field, String key) {
Task task = new Task();
task.setBaseEntityId(baseEntityId);
task.setKey(key);
- 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 73.
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 loadPreviousContactSchedule
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void loadPreviousContactSchedule(String baseEntityId, String contactNo, String edd) {
try {
Facts immediatePreviousSchedule = getPreviousContactRepository()
.getImmediatePreviousSchedule(baseEntityId, contactNo);
Method cleanValue
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressLint("NewApi")
static String cleanValue(String value) {
String returnValue = "";
try {
if (value.trim().length() > 0 && value.trim().charAt(0) == '[') {
Method getFormAsJson
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static JSONObject getFormAsJson(JSONObject form, String formName, String id, String currentLocationId)
throws Exception {
if (form == null) {
return null;
}
Method onBindViewHolder
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Field field = filterList.get(position);
holder.checkedTextView.setText(field.getDisplayName());
holder.checkedTextView.setTag(field);
Method getOpenTasks
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public List<Task> getOpenTasks(String baseEntityId) {
String orderBy = ID + " DESC ";
Cursor mCursor = null;
String selection = "";
String[] selectionArgs = new String[]{};
Method removeDueTests
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private JSONObject removeDueTests(JSONObject formObject, List<Task> taskList) {
JSONObject form = new JSONObject();
try {
Map<String, JSONObject> keys = taskHashMap(taskList);
if (formObject != null && taskList != null && taskList.size() > 0 && formObject.has(JsonFormConstants.STEP1)) {
Method getPartialContact
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public PartialContact getPartialContact(PartialContact partialContact) {
String selection = null;
String[] selectionArgs = null;
PartialContact dbPartialContact = null;
Cursor mCursor = null;
Method preProcessDefaultValues
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void preProcessDefaultValues(JSONObject object) {
try {
if (object != null) {
Iterator<String> keys = object.keys();
Method getClosedTasks
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public List<Task> getClosedTasks(String baseEntityId) {
String orderBy = ID + " DESC ";
Cursor mCursor = null;
String selection = "";
String[] selectionArgs = new String[]{};
Method processEventClient
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void processEventClient(@NonNull EventClient eventClient, @NonNull List<Event> unsyncEvents, @Nullable ClientClassification clientClassification) throws Exception {
Event event = eventClient.getEvent();
if (event == null) {
return;
Identical blocks of code found in 2 locations. Consider refactoring. Open
for (int i = 0; i < attentionFlagValueArray.size(); i++) {
String textToTranslate = attentionFlagValueArray.get(i).trim();
String translatedText = StringUtils.isNotBlank(textToTranslate) ? NativeFormLangUtils.translateDatabaseString(textToTranslate, AncLibrary.getInstance().getApplicationContext()) : "";
translatedList.add(translatedText);
}
- 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 72.
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
for (int i = 0; i < list.size(); i++) {
String text = list.get(i).trim();
String translated_text = StringUtils.isNotBlank(text) ? NativeFormLangUtils.translateDatabaseString(text, AncLibrary.getInstance().getApplicationContext()) : "";
finalList.add(translated_text);
}
- 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 72.
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
Consider simplifying this complex logical expression. Open
if (!TextUtils.isEmpty(ancId.getText()) || !TextUtils.isEmpty(firstName.getText()) ||
!TextUtils.isEmpty(lastName.getText()) || !TextUtils.isEmpty(edd.getText()) ||
!TextUtils.isEmpty(dob.getText()) || !TextUtils.isEmpty(phoneNumber.getText()) ||
!TextUtils.isEmpty(altContactName.getText())) {
search.setEnabled(true);
Method search
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public void search(String firstName, String lastName, String ancId, String edd, String dob, String phoneNumber,
String alternateContact, boolean isLocal) {
Method createEditMap
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public Map<String, String> createEditMap(String firstName, String lastName, String ancId, String edd, String dob,
String phoneNumber, String alternateContact, boolean isLocal) {
Method createEditMap
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Map<String, String> createEditMap(String firstName, String lastName, String ancId, String edd, String dob,
String phoneNumber, String alternateContact, boolean isLocal);
Method search
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
void search(String firstName, String lastName, String ancId, String edd, String dob, String phoneNumber,
String alternateContact, boolean isLocal);
Similar blocks of code found in 2 locations. Consider refactoring. Open
"CREATE TABLE " + TABLE_NAME + "(" + ID + " INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," + BASE_ENTITY_ID +
" VARCHAR NOT NULL, " + TYPE + " VARCHAR NOT NULL, " + FORM_JSON + " VARCHAR, " + FORM_JSON_DRAFT +
" VARCHAR, " + IS_FINALIZED + " INTEGER DEFAULT 0," + CONTACT_NO + " INTEGER NOT NULL, " + CREATED_AT +
- 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 70.
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