catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

Function view has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    view: function({state, attrs}) {
        const reward = state.normalReward(attrs.reward);

        return (h.rewardSouldOut(reward) ? m('') : m('span.radio.w-radio.w-clearfix.back-reward-radio-reward', {
            class: state.isSelected(reward) ? 'selected' : '',
Severity: Minor
Found in legacy/src/c/reward-select-card.js - About 4 hrs to fix

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

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

                    m('.card.u-marginbottom-20.u-radius.w-hidden-small.w-hidden-tiny', [
                        m('.fontsize-small.fontweight-semibold', window.I18n.t('contribution_warning.title', I18nScope())),
                        m('.fontsize-smaller.u-marginbottom-10', window.I18n.t('contribution_warning.subtitle', I18nScope())),
                        m('.fontcolor-secondary.fontsize-smallest.u-marginbottom-10', window.I18n.t('contribution_warning.info', I18nScope())),
                        m(`a.alt-link.fontsize-smallest[target="__blank"][href="${window.I18n.t('contribution_warning.link', I18nScope())}"]`, window.I18n.t('contribution_warning.link_label', I18nScope()))
Severity: Major
Found in legacy/src/root/projects-subscription-contribution.js and 1 other location - About 4 hrs to fix
legacy/src/root/projects-contribution.js on lines 85..90

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

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

                                m('.card.u-marginbottom-20.u-radius.w-hidden-small.w-hidden-tiny', [
                                    m('.fontsize-small.fontweight-semibold', window.I18n.t('contribution_warning.title', I18nScope())),
                                    m('.fontsize-smaller.u-marginbottom-10', window.I18n.t('contribution_warning.subtitle', I18nScope())),
                                    m('.fontcolor-secondary.fontsize-smallest.u-marginbottom-10', window.I18n.t('contribution_warning.info', I18nScope())),
                                    m(`a.alt-link.fontsize-smallest[target="__blank"][href="${window.I18n.t('contribution_warning.link', I18nScope())}"]`, window.I18n.t('contribution_warning.link_label', I18nScope()))
Severity: Major
Found in legacy/src/root/projects-contribution.js and 1 other location - About 4 hrs to fix
legacy/src/root/projects-subscription-contribution.js on lines 106..111

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

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 oninit has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    oninit: function(vnode) {
        const filtersVM = vnode.attrs.filtersVM,
            visitorsTotal = prop(0),
            visitorLoader = catarseMoments.loaderWithToken,
            loader = commonAnalytics.loaderWithToken,
Severity: Major
Found in legacy/src/c/project-insights-sub.js - About 4 hrs to fix

    File admin-balance-tranfers.js has 340 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import m from 'mithril';
    import prop from 'mithril/stream';
    import h from '../h';
    import _ from 'underscore';
    import balanceTransferListVM from '../vms/balance-transfer-list-vm';
    Severity: Minor
    Found in legacy/src/root/admin-balance-tranfers.js - About 4 hrs to fix

      File common-payment-vm.js has 340 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import m from 'mithril';
      import prop from 'mithril/stream';
      import _ from 'underscore';
      import projectVM from '../vms/project-vm';
      import addressVM from '../vms/address-vm';
      Severity: Minor
      Found in legacy/src/vms/common-payment-vm.js - About 4 hrs to fix

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

                                m('.w-sub-col.w-col.w-col-4', [
                                    m('.field-label.fontweight-semibold', `${window.I18n.t('address_number', I18nScope())} *`),
                                    m('input.positive.text-field.w-input[required=\'required\'][type=\'text\']', {
                                        class: errors.addressNumber() ? 'error' : '',
                                        value: fields.addressNumber(),
        Severity: Major
        Found in legacy/src/c/address-form-national.js and 3 other locations - About 4 hrs to fix
        legacy/src/c/address-form-national.js on lines 61..73
        legacy/src/c/address-form-national.js on lines 95..107
        legacy/src/c/address-form-national.js on lines 110..122

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

        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

                                m('.w-sub-col.w-col.w-col-6', [
                                    m('.field-label.fontweight-semibold', `${window.I18n.t('address_city', I18nScope())} *`),
                                    m('input.positive.text-field.w-input[required="required"][type="text"]', {
                                        class: errors.addressCity() ? 'error' : '',
                                        value: fields.addressCity(),
        Severity: Major
        Found in legacy/src/c/address-form-national.js and 3 other locations - About 4 hrs to fix
        legacy/src/c/address-form-national.js on lines 61..73
        legacy/src/c/address-form-national.js on lines 75..87
        legacy/src/c/address-form-national.js on lines 95..107

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

        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

                            m('.w-row', [
                                m('.field-label.fontweight-semibold', `${window.I18n.t('address_street', I18nScope())} *`),
                                m('input.positive.text-field.w-input[maxlength=\'50\'][required=\'required\'][type=\'text\']', {
                                    class: errors.addressStreet() ? 'error' : '',
                                    value: fields.addressStreet(),
        Severity: Major
        Found in legacy/src/c/address-form-national.js and 3 other locations - About 4 hrs to fix
        legacy/src/c/address-form-national.js on lines 75..87
        legacy/src/c/address-form-national.js on lines 95..107
        legacy/src/c/address-form-national.js on lines 110..122

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

        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

                                m('.w-col.w-col-4', [
                                    m('.field-label.fontweight-semibold', `${window.I18n.t('address_neighbourhood', I18nScope())} *`),
                                    m('input.positive.text-field.w-input[maxlength="30"][required="required"][type="text"]', {
                                        class: errors.addressNeighbourhood() ? 'error' : '',
                                        value: fields.addressNeighbourhood(),
        Severity: Major
        Found in legacy/src/c/address-form-national.js and 3 other locations - About 4 hrs to fix
        legacy/src/c/address-form-national.js on lines 61..73
        legacy/src/c/address-form-national.js on lines 75..87
        legacy/src/c/address-form-national.js on lines 110..122

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

        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 oninit has 103 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            oninit: function(vnode) {
                h.analytics.windowScroll({ cat: 'project_start', act: 'start_page_scroll' });
                const stats = prop([]),
                    categories = prop([]),
                    selectedPane = prop(0),
        Severity: Major
        Found in legacy/src/root/start.js - About 4 hrs to fix

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

                                              m('.w-row', [
                                                  m('.w-col.w-col-6.w-col-small-6.w-col-tiny-6.w-sub-col-middle', [
                                                      m('label.text.required.field-label.field-label.fontweight-semibold.force-text-dark[for=\'user_bank_account_attributes_agency\']',
                                                          'Agência'
                                                      ),
          Severity: Major
          Found in legacy/src/c/user-billing.js and 1 other location - About 4 hrs to fix
          legacy/src/c/user-billing.js on lines 198..219

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

          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

                  it('shoud render the outerLabel on first render', () => {
                      expect($output.contains(args.outerLabel)).toBeTrue();
                      expect($output.contains(args.innerLabel)).toBeFalse();
                      expect($output.contains(args.placeholder)).toBeFalse();
                      expect($output.contains(args.callToAction)).toBeFalse();
          Severity: Major
          Found in legacy/spec/components/admin-external-action.spec.js and 1 other location - About 4 hrs to fix
          legacy/spec/components/admin-input-action.spec.js on lines 76..81

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

          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

                  it('shoud render the outerLabel on first render', () => {
                      expect($output.contains(args.outerLabel)).toBeTrue();
                      expect($output.contains(args.innerLabel)).toBeFalse();
                      expect($output.contains(args.placeholder)).toBeFalse();
                      expect($output.contains(args.callToAction)).toBeFalse();
          Severity: Major
          Found in legacy/spec/components/admin-input-action.spec.js and 1 other location - About 4 hrs to fix
          legacy/spec/components/admin-external-action.spec.js on lines 38..43

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

          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('.w-row', [
                                          m('.w-col.w-col-6.w-sub-col', [
                                              m('label.text.required.field-label.field-label.fontweight-semibold.force-text-dark[for=\'user_bank_account_attributes_owner_name\']',
                                                  'Nome do titular'
                                              ),
          Severity: Major
          Found in legacy/src/c/user-billing.js and 1 other location - About 4 hrs to fix
          legacy/src/c/user-billing.js on lines 343..364

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

          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 oninit has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              oninit: function(vnode) {
                  const subscription = vnode.attrs.subscription,
                      displayModal = h.toggleProp(false, true),
                      displayCancelModal = h.toggleProp(false, true),
                      displayPaymentHistoryModal = h.toggleProp(false, true),
          Severity: Minor
          Found in legacy/src/c/user-subscription-box.js - About 4 hrs to fix

          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

          Function addressVM has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

          const addressVM = (args) => {
              const data = args.data;
              const international = prop();
              const statesLoader = catarse.loader(models.state.getPageOptions());
          
          
          Severity: Minor
          Found in legacy/src/vms/address-vm.js - About 4 hrs to fix

          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

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

              oninit: function (vnode) {
                  let parsedErrors = userSettingsVM.mapRailsErrors(vnode.attrs.rails_errors);
                  const user = vnode.attrs.user;
                  const fields = {
                      agency: prop(''),
          Severity: Major
          Found in legacy/src/c/user-balance-request-modal-content.js - About 4 hrs to fix

            Function htmlentities has 102 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function htmlentities(text) {
                return text
                .replace(/\"/gi, '"')
                .replace(/\'/gi, '\'')
                .replace(/\&/gi, '&')
            Severity: Major
            Found in legacy/vendor/mithril-generative-trust.js - About 4 hrs to fix

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

                var specDiv = this.createDom('div', { className: 'spec '  + status },
                    this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
                    this.createDom('a', {
                      className: 'description',
                      href: '?spec=' + encodeURIComponent(spec.getFullName()),
              Severity: Major
              Found in legacy/spec/lib/jasmine/jasmine-html.js and 1 other location - About 4 hrs to fix
              legacy/spec/lib/jasmine-species/jasmine-reporting.js on lines 115..121

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

              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