catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

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

                            m(surveyPreview, {
                                confirmAddress: survey.confirm_address,
                                countryName: countryName(),
                                stateName: stateName(),
                                fields: state.addVM().getFields(),
Severity: Major
Found in legacy/src/root/surveys-show.js and 2 other locations - About 1 hr to fix
legacy/src/root/surveys-show.js on lines 216..223
legacy/src/root/surveys-show.js on lines 337..344

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

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 (fields().account_type() != 'pf') {
                    fields().owner_document(documentCompanyMask(value));
                } else {
                    fields().owner_document(documentMask(value));
                }
Severity: Major
Found in legacy/src/c/user-settings.js and 1 other location - About 1 hr to fix
legacy/spec/components/user-settings-responsible.spec.js on lines 32..36

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

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

                                                m(surveyPreview, {
                                                    confirmAddress: survey.confirm_address,
                                                    countryName: countryName(),
                                                    stateName: stateName(),
                                                    fields: state.addVM().getFields(),
Severity: Major
Found in legacy/src/root/surveys-show.js and 2 other locations - About 1 hr to fix
legacy/src/root/surveys-show.js on lines 216..223
legacy/src/root/surveys-show.js on lines 244..251

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

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 3 locations. Consider refactoring.
Open

            beforeAll(() => {
                jasmine.Ajax.stubRequest(
                    `${apiPrefix}/projects?order=open_for_contributions.desc%2Cstate_order.asc%2Cstate.desc%2Cscore.desc%2Cpledged.desc&state=eq.online&category_id=eq.1&open_for_contributions=eq.true`
                ).andReturn({
                    responseHeaders: {
Severity: Major
Found in legacy/spec/components/vms/projects-explore-vm.spec.js and 2 other locations - About 1 hr to fix
legacy/spec/components/vms/projects-explore-vm.spec.js on lines 6..15
legacy/spec/components/vms/projects-explore-vm.spec.js on lines 130..139

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

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 3 locations. Consider refactoring.
Open

    story: function(description, specDefinitions) {
        var suite = jasmine.grammar.getEnv().describe('Story: ' + description, specDefinitions);
        suite.tags = ['story'];
        return suite;
    },
Severity: Major
Found in legacy/spec/lib/jasmine-species/jasmine-grammar.js and 2 other locations - About 1 hr to fix
legacy/spec/lib/jasmine-species/jasmine-grammar.js on lines 28..32
legacy/spec/lib/jasmine-species/jasmine-grammar.js on lines 46..50

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

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 2 locations. Consider refactoring.
Open

                                                m('input.positive.text-field.w-input', {
    value: state.selectedItemSubjectTemplate(),
    oninput: m.withAttr('value', (v) => {
        state.selectedItemSubjectTemplate(v);
        state.renderSubjectTemplate(v);
Severity: Major
Found in legacy/src/root/admin-notifications.js and 1 other location - About 1 hr to fix
legacy/src/root/admin-notifications.js on lines 154..160

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

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 2 locations. Consider refactoring.
Open

                m('textarea.positive.text-field.w-input[rows="20"]', {
                    value: state.selectedItemTemplate(),
                    oninput: m.withAttr('value', (v) => {
                        state.selectedItemTemplate(v);
                        state.renderTemplate(v);
Severity: Major
Found in legacy/src/root/admin-notifications.js and 1 other location - About 1 hr to fix
legacy/src/root/admin-notifications.js on lines 139..145

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

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 (commonData.subscription_id) {
                        sendSubscriptionUpgrade(payload).then(resolve).catch(reject);
                    } else {
                        sendPaymentRequest(payload).then(resolve).catch(reject);
                    }
Severity: Major
Found in legacy/src/vms/common-payment-vm.js and 1 other location - About 1 hr to fix
legacy/src/vms/common-payment-vm.js on lines 334..338

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

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 (commonData.subscription_id) {
                sendSubscriptionUpgrade(payload).then(resolve).catch(reject);
            } else {
                sendPaymentRequest(payload).then(resolve).catch(reject);
            }
Severity: Major
Found in legacy/src/vms/common-payment-vm.js and 1 other location - About 1 hr to fix
legacy/src/vms/common-payment-vm.js on lines 265..269

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

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 (fields().account_type() != 'pf') {
                fields().owner_document(documentCompanyMask(value));
            } else {
                fields().owner_document(documentMask(value));
            }
Severity: Major
Found in legacy/spec/components/user-settings-responsible.spec.js and 1 other location - About 1 hr to fix
legacy/src/c/user-settings.js on lines 113..117

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

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 3 locations. Consider refactoring.
Open

    component: function(description, specDefinitions) {
        var suite = jasmine.grammar.getEnv().describe('Component: ' + description, specDefinitions);
        suite.tags = ['component'];
        return suite;
    },
Severity: Major
Found in legacy/spec/lib/jasmine-species/jasmine-grammar.js and 2 other locations - About 1 hr to fix
legacy/spec/lib/jasmine-species/jasmine-grammar.js on lines 28..32
legacy/spec/lib/jasmine-species/jasmine-grammar.js on lines 37..41

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

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 2 locations. Consider refactoring.
Open

                <div class="card-project-description">
                    <div class="fontweight-semibold fontsize-base u-marginbottom-10 u-text-center-small-only lineheight-tight">
                        {name}
                    </div>
                    <div class="fontcolor-secondary fontsize-smaller w-hidden-small w-hidden-tiny">
legacy/src/c/explore/explore-search-param.tsx on lines 19..26

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

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 2 locations. Consider refactoring.
Open

                    <div class='explore-span-filter-name'>
                        <div class='explore-mobile-label'>
                            {mobileLabel}
                        </div>
                        <div class='inline-block'>
Severity: Major
Found in legacy/src/c/explore/explore-search-param.tsx and 1 other location - About 1 hr to fix
legacy/src/c/projects/publish-by-steps/project-card-simple.tsx on lines 25..32

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

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

Function fetch has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            fetch = (token, pageUrl) => {
                if (!modalToggle()) {
                    modalToggle.toggle();
                    loadingContacts(true);
                    m.redraw();
Severity: Minor
Found in legacy/src/c/project-google-contact-import.js - About 1 hr to fix

    Function updateUserData has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                updateUserData = (user_id) => {
                    const userData = {
                        owner_name: fields.owner_name(),
                        owner_document: fields.owner_document(),
                        bank_id: bankCode(),
    Severity: Minor
    Found in legacy/src/c/user-billing.js - About 1 hr to fix

      Function oninit has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          oninit: function(vnode) {
              const statusClass = {
                      active: 'fa-circle.text-success',
                      started: 'fa-circle.text-waiting',
                      inactive: 'fa-circle.text-error',
      Severity: Minor
      Found in legacy/src/c/subscription-status-icon.js - About 1 hr to fix

        Function oninit has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            oninit: function(vnode) {
                let interval;
                const collection = prop([]),
                    resource = prop(),
                    collectionIndex = prop(0),
        Severity: Minor
        Found in legacy/src/c/contribution-activities.js - About 1 hr to fix

          Function origin has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var origin = (function(request,cookie) {
                try {
                  var o = JSON.parse(cookie.get('ctrse_origin')||null) || {createdAt: new Date()};
                } catch(e) {
                  o = {createdAt: new Date()};
          Severity: Minor
          Found in legacy/spec/lib/analytics.js - About 1 hr to fix

            Function parseDate has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              I18n.parseDate = function(date) {
                var matches, convertedDate, fraction;
                // we have a date, so just return it.
                if (typeof(date) == "object") {
                  return date;
            Severity: Minor
            Found in legacy/spec/lib/i18n/i18n.js - About 1 hr to fix

              Function WhenChangeNationality has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function WhenChangeNationality(user : UserDetails, states: prop<State[]>) : UserAddress {
                  const defaultCountryID = 36 // Brasil
                  const isInternational = Number(user.address.country_id) !== defaultCountryID
              
                  if (!_.isEmpty(states()) && !isInternational) {
              Severity: Minor
              Found in legacy/src/c/projects/publish-by-steps/user-info-edit-settings.tsx - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language