catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

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

    oninit: function(vnode) {
        const user_id = vnode.attrs.userId,
            userCommonId = vnode.attrs.user && vnode.attrs.user.common_id,
            subscriptions = getUserPrivateSubscriptionsListVM(userCommonId),
            onlinePages = contributionVM.getUserContributionsListWithFilter(),
Severity: Major
Found in legacy/src/c/user-private-contributed.js - About 3 hrs to fix

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

                  (state.displayDeliverModal() ? m(modalBox, {
                      displayModal: state.displayDeliverModal,
                      hideCloseButton: false,
                      content: [deliverContributionModalContent, { project: attrs.project, displayModal: state.displayDeliverModal, amount: state.selectedContributions().length, updateStatus: state.updateStatus, message: state.deliveryMessage }]
                  }) : ''),
    Severity: Major
    Found in legacy/src/c/project-contribution-report-content.js and 1 other location - About 3 hrs to fix
    legacy/src/c/project-contribution-report-content.js on lines 78..82

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

    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

    jasmine.getGlobal().setTimeout = function(funcToCall, millis) {
      if (jasmine.Clock.installed.setTimeout.apply) {
        return jasmine.Clock.installed.setTimeout.apply(this, arguments);
      } else {
        return jasmine.Clock.installed.setTimeout(funcToCall, millis);
    Severity: Major
    Found in legacy/spec/lib/jasmine/jasmine.js and 1 other location - About 3 hrs to fix
    legacy/spec/lib/jasmine/jasmine.js on lines 2391..2397

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

    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

                  (state.displayErrorModal() ? m(modalBox, {
                      displayModal: state.displayErrorModal,
                      hideCloseButton: false,
                      content: [errorContributionModalContent, { project: attrs.project, displayModal: state.displayErrorModal, amount: state.selectedContributions().length, updateStatus: state.updateStatus, message: state.deliveryMessage }]
                  }) : ''),
    Severity: Major
    Found in legacy/src/c/project-contribution-report-content.js and 1 other location - About 3 hrs to fix
    legacy/src/c/project-contribution-report-content.js on lines 83..87

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

    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

    jasmine.getGlobal().setInterval = function(funcToCall, millis) {
      if (jasmine.Clock.installed.setInterval.apply) {
        return jasmine.Clock.installed.setInterval.apply(this, arguments);
      } else {
        return jasmine.Clock.installed.setInterval(funcToCall, millis);
    Severity: Major
    Found in legacy/spec/lib/jasmine/jasmine.js and 1 other location - About 3 hrs to fix
    legacy/spec/lib/jasmine/jasmine.js on lines 2383..2389

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

    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

    File user-info-edit-settings.tsx has 291 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import m from 'mithril';
    import prop from 'mithril/stream';
    import _ from 'underscore';
    import { StreamType } from '../../../@types/reward-details-stream';
    import { UserDetails } from '../../../@types/user-details';
    Severity: Minor
    Found in legacy/src/c/projects/publish-by-steps/user-info-edit-settings.tsx - About 3 hrs to fix

      Function view has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          view({ state, attrs }) {
              const project_id = attrs.project_id;
              const user_id = attrs.user_id;
              const error = state.error;
              const errors = state.errors;
      Severity: Major
      Found in legacy/src/root/project-edit-reward.js - About 2 hrs to fix

        File user-subscription-box.js has 290 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import m from 'mithril';
        import prop from 'mithril/stream';
        import _ from 'underscore';
        import h from '../h';
        import moment from 'moment';
        Severity: Minor
        Found in legacy/src/c/user-subscription-box.js - About 2 hrs to fix

          Function hasError has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      hasError: (field : string) => {
                          switch(field) {
                              case 'address_zip_code': {
                                  errors.addressZipCode(hasErrorOn(field))
                                  break;
          Severity: Major
          Found in legacy/src/c/projects/publish-by-steps/user-info-edit-settings.tsx - About 2 hrs to fix

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

                const resetCreditCardFieldError = fieldName => () => {
                    const errors = fields.errors(),
                        errorField = _.findWhere(creditCardFields.errors(), { field: fieldName }),
                        newErrors = _.compose(creditCardFields.errors, _.without);
            
            
            Severity: Major
            Found in legacy/src/vms/payment-vm.js and 1 other location - About 2 hrs to fix
            legacy/src/vms/payment-vm.js on lines 386..392

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

            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

            jasmine.getGlobal().clearTimeout = function(timeoutKey) {
              if (jasmine.Clock.installed.clearTimeout.apply) {
                return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
              } else {
                return jasmine.Clock.installed.clearTimeout(timeoutKey);
            Severity: Major
            Found in legacy/spec/lib/jasmine/jasmine.js and 1 other location - About 2 hrs to fix
            legacy/spec/lib/jasmine/jasmine.js on lines 2407..2413

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

            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

            jasmine.getGlobal().clearInterval = function(timeoutKey) {
              if (jasmine.Clock.installed.clearTimeout.apply) {
                return jasmine.Clock.installed.clearInterval.apply(this, arguments);
              } else {
                return jasmine.Clock.installed.clearInterval(timeoutKey);
            Severity: Major
            Found in legacy/spec/lib/jasmine/jasmine.js and 1 other location - About 2 hrs to fix
            legacy/spec/lib/jasmine/jasmine.js on lines 2399..2405

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

            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

                    it('should select other values', () => {
                        component.click('.explore-span-filter', new Event('click'));
                        component.click(`a.fontsize-smallest.link-hidden-light:contains("${values[0].label}")`,  new Event('click'));
                        component.should.have(`.explore-span-filter-name > .inline-block:contains("${values[0].label}")`);
                    });
            Severity: Major
            Found in legacy/spec/components/explore-search-filter-select.spec.js and 2 other locations - About 2 hrs to fix
            legacy/spec/components/explore-filter-select.spec.js on lines 54..58
            legacy/spec/components/explore-filter-select.spec.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 94.

            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

                const resetFieldError = fieldName => () => {
                    const errors = fields.errors(),
                        errorField = _.findWhere(fields.errors(), { field: fieldName }),
                        newErrors = _.compose(fields.errors, _.without);
            
            
            Severity: Major
            Found in legacy/src/vms/payment-vm.js and 1 other location - About 2 hrs to fix
            legacy/src/vms/payment-vm.js on lines 394..400

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

            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

                        it('should select other values', () => {
                            component.click('.explore-span-filter', new Event('click'));
                            component.click(`a.explore-filter-link:contains("${values[1].label}")`, new Event('click'));
                            component.should.have(`.inline-block:contains("${values[1].label}")`);
                        });
            Severity: Major
            Found in legacy/spec/components/explore-filter-select.spec.js and 2 other locations - About 2 hrs to fix
            legacy/spec/components/explore-filter-select.spec.js on lines 113..117
            legacy/spec/components/explore-search-filter-select.spec.js on lines 54..58

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

            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

                        it('should select other values', () => {
                            component.click('.explore-span-filter', new Event('click'));
                            component.click(`a.explore-filter-link:contains("${values[1].label}")`, new Event('click'));
                            component.should.have(`.inline-block:contains("${values[1].label}")`);
                        });
            Severity: Major
            Found in legacy/spec/components/explore-filter-select.spec.js and 2 other locations - About 2 hrs to fix
            legacy/spec/components/explore-filter-select.spec.js on lines 54..58
            legacy/spec/components/explore-search-filter-select.spec.js on lines 54..58

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

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

                view({ state, attrs }) {
            
                    const GATrackingID = state.GATrackingID;
                    const FBPixelTrackingID = state.FBPixelTrackingID;
                    const save = state.save;
            Severity: Major
            Found in legacy/src/root/project-edit-integrations.js - About 2 hrs to fix

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

                  oninit: function(vnode) {
                      const storeKey = 'selectedReward',
                          MINIMUM_VALUE = 10,
                          reward = vnode.attrs.reward,
                          vm = rewardVM,
              Severity: Major
              Found in legacy/src/c/project-reward-card.js - About 2 hrs to fix

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

                    oninit: function(vnode) {
                        const MINIMUM_VALUE = 10;
                        const queryRewardValue = h.getParams('value');
                        const setInput = localVnode => localVnode.dom.focus();
                        const isSelected = currentReward => (currentReward.id == null && !rewardVM.selectedReward() && queryRewardValue) || (rewardVM.selectedReward() && currentReward.id === rewardVM.selectedReward().id);
                Severity: Major
                Found in legacy/src/c/reward-select-card.js - About 2 hrs to fix

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

                      view: function({ state, attrs }) {
                  
                          if (state.parsedErrors) {
                              const parsedErrors = state.parsedErrors;
                              state.fields.errors = {
                  Severity: Minor
                  Found in legacy/src/c/address-form.js - About 2 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

                  Severity
                  Category
                  Status
                  Source
                  Language