OpenSRP/opensrp-client-anc

View on GitHub

Showing 436 of 436 total issues

Similar blocks of code found in 7 locations. Consider refactoring.
Open

    public PreviousContact(String baseEntityId, String key, String value, String contactNo) {
        this.baseEntityId = baseEntityId;
        this.key = key;
        this.value = value;
        this.contactNo = contactNo;
opensrp-anc/src/main/java/org/smartregister/anc/library/domain/LastContactDetailsWrapper.java on lines 13..19
opensrp-anc/src/main/java/org/smartregister/anc/library/domain/YamlConfig.java on lines 19..24
opensrp-anc/src/main/java/org/smartregister/anc/library/domain/YamlConfigWrapper.java on lines 19..25
opensrp-anc/src/main/java/org/smartregister/anc/library/listener/DatePickerListener.java on lines 24..29
opensrp-anc/src/main/java/org/smartregister/anc/library/model/ContactSummaryModel.java on lines 25..30
opensrp-anc/src/main/java/org/smartregister/anc/library/model/PartialContacts.java on lines 20..25

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 49.

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

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

    public ContactSummaryModel(String contactName, String contactDate, Date localDate, String contactWeeks) {
        this.contactName = contactName;
        this.contactDate = contactDate;
        this.localDate = localDate;
        this.contactWeeks = contactWeeks;
opensrp-anc/src/main/java/org/smartregister/anc/library/domain/LastContactDetailsWrapper.java on lines 13..19
opensrp-anc/src/main/java/org/smartregister/anc/library/domain/YamlConfig.java on lines 19..24
opensrp-anc/src/main/java/org/smartregister/anc/library/domain/YamlConfigWrapper.java on lines 19..25
opensrp-anc/src/main/java/org/smartregister/anc/library/listener/DatePickerListener.java on lines 24..29
opensrp-anc/src/main/java/org/smartregister/anc/library/model/PartialContacts.java on lines 20..25
opensrp-anc/src/main/java/org/smartregister/anc/library/model/PreviousContact.java on lines 15..20

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 49.

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

Further Reading

Method updateEventAndRequiredStepsField has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    private void updateEventAndRequiredStepsField(String baseEntityId, PartialContactRepository partialContactRepository,
                                                  List<PartialContact> partialContactList, Facts facts, List<String> formSubmissionIDs) throws Exception {

    Method setQuickCheckButtonsVisible has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        private void setQuickCheckButtonsVisible(boolean none, boolean other, LinearLayout buttonLayout, Button referButton, Button proceedButton) {

      Method setQuickCheckButtonsInvisible has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private void setQuickCheckButtonsInvisible(boolean none, boolean other, LinearLayout buttonLayout, Button referButton, Button proceedButton) {

        Method getFooterView has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public void getFooterView(RecyclerView.ViewHolder viewHolder, int currentPageCount, int totalPageCount, boolean hasNext,
                                      boolean hasPrevious) {

          Method init has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static void init(@NonNull Context context, int dbVersion, @NonNull ActivityConfiguration activityConfiguration, @Nullable SubscriberInfoIndex subscriberInfoIndex, @Nullable RegisterQueryProvider registerQueryProvider) {
          Severity: Minor
          Found in opensrp-anc/src/main/java/org/smartregister/anc/library/AncLibrary.java - About 35 mins to fix

            Method getFooterView has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public void getFooterView(RecyclerView.ViewHolder viewHolder, int currentPageCount, int totalPageCount, boolean hasNext,
                                          boolean hasPrevious) {

              Method createEvent has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  private void createEvent(String baseEntityId, String attentionFlagsString, Pair<Event, Event> eventPair,
                                           String referral, String currentContactState)

                Method addMapValues has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    private void addMapValues(String field, boolean isLocal, Map<String, String> editMap, String key, String globalField) {

                  Method unSync has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      private boolean unSync(ECSyncHelper ecSyncHelper, DetailsRepository detailsRepository, List<Table> bindObjects,
                                             Event event, String registeredAnm) {

                    Identical blocks of code found in 3 locations. Consider refactoring.
                    Open

                        public void onDestroy(boolean isChangingConfiguration) {
                            mProfileView = null;//set to null on destroy
                    
                            // Inform interactor
                            if (mProfileInteractor != null) {
                    opensrp-anc/src/main/java/org/smartregister/anc/library/presenter/PreviousContactTestsPresenter.java on lines 35..49
                    opensrp-anc/src/main/java/org/smartregister/anc/library/presenter/ProfileFragmentPresenter.java on lines 34..46

                    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 46.

                    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

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                            try {
                                sqb.addCondition(filters);
                                query = sqb.orderbyCondition(Sortqueries);
                                query = sqb.Endquery(
                                        sqb.addlimitandOffset(query, clientAdapter.getCurrentlimit(), clientAdapter.getCurrentoffset()));
                    opensrp-anc/src/main/java/org/smartregister/anc/library/fragment/HomeRegisterFragment.java on lines 268..274

                    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 46.

                    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

                    Further Reading

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                                        case ConstantsUtils.AlertStatusUtils.OVERDUE:
                                            dueButton.setBackgroundColor(context.getResources().getColor(R.color.vaccine_red_bg_st));
                                            dueButton.setTextColor(context.getResources().getColor(R.color.white));
                                            break;
                    opensrp-anc/src/main/java/org/smartregister/anc/library/util/Utils.java on lines 548..551
                    opensrp-anc/src/main/java/org/smartregister/anc/library/util/Utils.java on lines 552..555
                    opensrp-anc/src/main/java/org/smartregister/anc/library/util/Utils.java on lines 560..563

                    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 46.

                    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

                    Further Reading

                    Identical blocks of code found in 3 locations. Consider refactoring.
                    Open

                        public void onDestroy(boolean isChangingConfiguration) {
                            mProfileView = null;//set to null on destroy
                    
                            // Inform interactor
                            if (mProfileInteractor != null) {
                    opensrp-anc/src/main/java/org/smartregister/anc/library/presenter/PreviousContactDetailsPresenter.java on lines 44..56
                    opensrp-anc/src/main/java/org/smartregister/anc/library/presenter/PreviousContactTestsPresenter.java on lines 35..49

                    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 46.

                    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

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                                    if (!TextUtils.isEmpty(filters) && TextUtils.isEmpty(Sortqueries)) {
                                        registerQueryBuilder.addCondition(filters);
                                        query = registerQueryBuilder.orderbyCondition(Sortqueries);
                                        query = registerQueryBuilder.Endquery(registerQueryBuilder.addlimitandOffset(query
                                                , clientAdapter.getCurrentlimit()
                    opensrp-anc/src/main/java/org/smartregister/anc/library/fragment/AdvancedSearchFragment.java on lines 218..223

                    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 46.

                    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

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public static JsonWizardFormFragment getFormFragment(String stepName) {
                            ContactWizardJsonFormFragment jsonFormFragment = new ContactWizardJsonFormFragment();
                            Bundle bundle = new Bundle();
                            bundle.putString(DBConstantsUtils.KeyUtils.STEPNAME, stepName);
                            jsonFormFragment.setArguments(bundle);
                    opensrp-anc/src/main/java/org/smartregister/anc/library/fragment/ANCRegisterFormFragment.java on lines 20..27

                    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 46.

                    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

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public static JsonFormFragment getFormFragment(String stepName) {
                            ANCRegisterFormFragment jsonFormFragment = new ANCRegisterFormFragment();
                            Bundle bundle = new Bundle();
                            bundle.putString(JsonFormConstants.JSON_FORM_KEY.STEPNAME, stepName);
                            jsonFormFragment.setArguments(bundle);
                    opensrp-anc/src/main/java/org/smartregister/anc/library/fragment/ContactWizardJsonFormFragment.java on lines 54..60

                    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 46.

                    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

                    Further Reading

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                                        case ConstantsUtils.AlertStatusUtils.NOT_DUE:
                                            dueButton.setBackground(context.getResources().getDrawable(R.drawable.contact_not_due));
                                            dueButton.setTextColor(context.getResources().getColor(R.color.dark_grey));
                                            break;
                    opensrp-anc/src/main/java/org/smartregister/anc/library/util/Utils.java on lines 548..551
                    opensrp-anc/src/main/java/org/smartregister/anc/library/util/Utils.java on lines 552..555
                    opensrp-anc/src/main/java/org/smartregister/anc/library/util/Utils.java on lines 556..559

                    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 46.

                    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

                    Further Reading

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                                        case ConstantsUtils.AlertStatusUtils.DUE:
                                            dueButton.setBackground(context.getResources().getDrawable(R.drawable.contact_due));
                                            dueButton.setTextColor(context.getResources().getColor(R.color.vaccine_blue_bg_st));
                                            break;
                    opensrp-anc/src/main/java/org/smartregister/anc/library/util/Utils.java on lines 548..551
                    opensrp-anc/src/main/java/org/smartregister/anc/library/util/Utils.java on lines 556..559
                    opensrp-anc/src/main/java/org/smartregister/anc/library/util/Utils.java on lines 560..563

                    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 46.

                    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

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language