catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

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

            it('should render reminder when project is open_for_contributions and user not signed in', () => {
                let {
                    output, projectDetail
                } = generateContextByNewState({
                    open_for_contributions: true,
Severity: Major
Found in legacy/spec/components/project-sidebar.spec.js and 1 other location - About 1 hr to fix
legacy/spec/components/project-sidebar.spec.js on lines 117..126

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 73.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

            it('should not render reminder when project is not open_for_contributions and user signed in', () => {
                let {
                    output, projectDetail
                } = generateContextByNewState({
                    open_for_contributions: false,
Severity: Major
Found in legacy/spec/components/project-sidebar.spec.js and 1 other location - About 1 hr to fix
legacy/spec/components/project-sidebar.spec.js on lines 106..115

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 73.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        const keysAndValues = reduceSearchString((finalQueryObject, keyValue) => {
            const [key, value] = keyValue.split('=');
            if (!resetParams.includes(key) && key) {
                finalQueryObject[key] = value;
            }
Severity: Major
Found in legacy/src/h.ts and 1 other location - About 1 hr to fix
legacy/src/h.ts on lines 176..183

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 73.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        const keysAndValues = reduceSearchString((finalQueryObject, keyValue) => {

            const [key, value] = keyValue.split('=');            
            if (!paramsNamesToRemove.includes(key) && key) {
                finalQueryObject[key] = value;
Severity: Major
Found in legacy/src/h.ts and 1 other location - About 1 hr to fix
legacy/src/h.ts on lines 128..134

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 73.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

                    view({state, attrs}) {
                        return m('', [
                            m('.modal-dialog-header', [
                                m('.fontsize-large.u-text-center', attrs.modalTitle)
                            ]),
Severity: Minor
Found in legacy/src/root/admin-subscriptions.js - About 1 hr to fix

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

        oninit: function(vnode) {
            const vm = vnode.attrs.vm,
                isSubscriptionEdit = vnode.attrs.isSubscriptionEdit || prop(false),
                slipPaymentDate = projectVM.isSubscription() ? null : vm.getSlipPaymentDate(vnode.attrs.contribution_id),
                loading = prop(false),
    Severity: Minor
    Found in legacy/src/c/payment-slip.js - About 1 hr to fix

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

          view({state, attrs}) {
          
              const isSelected = attrs.isSelected;
              const itemToString = attrs.itemToString;
              const onSelect = attrs.onSelect;
      Severity: Minor
      Found in legacy/src/c/explore/explore-filter-select.ts - About 1 hr to fix

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

                                (project.state === 'draft' && projectVM.isSubscription(project)) ?
                                m(`a#dashboard_home_link[class="${editLinkClass('#start')}"][href="${editRoute}#start"]`, [
                                    m('span.fa.fa-info.fa-lg.fa-fw'), window.I18n.t('draft_start_tab', I18nScope())
                                ]) :
                                m(`a#dashboard_home_link[class="dashboard-nav-link-left ${h.locationActionMatch('insights') ? 'selected' : ''}"][href="${projectRoute}/insights"]`, {
        Severity: Major
        Found in legacy/src/c/project-dashboard-menu.js and 2 other locations - About 1 hr to fix
        legacy/src/c/project-dashboard-menu.js on lines 103..113
        legacy/src/c/project-dashboard-menu.js on lines 122..127

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 72.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                                    (projectVM.isSubscription(project) ? '' :
                                        m(`a#dashboard_surveys_link[class="dashboard-nav-link-left ${h.locationActionMatch('surveys') ? 'selected' : ''}"][href="${projectRoute}/surveys"]`, {
                                            oncreate: m.route.link
                                        }, [
                                            m('span.fa.fa.fa-check-square-o.fa-lg.fa-fw'), window.I18n.t('surveys_tab', I18nScope())
        Severity: Major
        Found in legacy/src/c/project-dashboard-menu.js and 2 other locations - About 1 hr to fix
        legacy/src/c/project-dashboard-menu.js on lines 94..102
        legacy/src/c/project-dashboard-menu.js on lines 103..113

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 72.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                                    projectVM.isSubscription(project) ?
                                    m(`a#dashboard_subscriptions_link[class="dashboard-nav-link-left ${h.locationActionMatch('subscriptions_report') ? 'selected' : ''}"][href="${projectRoute}/subscriptions_report"]`, {
                                        oncreate: m.route.link
                                    }, [
                                        m('span.fa.fa.fa-users.fa-lg.fa-fw'), window.I18n.t('subscriptions_tab', I18nScope())
        Severity: Major
        Found in legacy/src/c/project-dashboard-menu.js and 2 other locations - About 1 hr to fix
        legacy/src/c/project-dashboard-menu.js on lines 94..102
        legacy/src/c/project-dashboard-menu.js on lines 122..127

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 72.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                                            m('select.w-select.text-field.medium.u-marginbottom-40', {
                                                name: 'project[category_id]',
                                                class: state.projectCategoryError() ? 'error' : '',
                                                onfocus: () => state.projectCategoryError(false),
                                                onchange: (e) => {
        Severity: Major
        Found in legacy/src/root/sub-project-new.js and 1 other location - About 1 hr to fix
        legacy/src/root/sub-project-new.js on lines 64..71

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 72.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                                            m('input.w-input.text-field.medium.u-marginbottom-30[type="text"]', {
                                                name: 'project[name]',
                                                class: state.projectNameError() ? 'error' : '',
                                                onfocus: () => state.projectNameError(false),
                                                onchange: (e) => {
        Severity: Major
        Found in legacy/src/root/sub-project-new.js and 1 other location - About 1 hr to fix
        legacy/src/root/sub-project-new.js on lines 75..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 72.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

            oninit: function(vnode) {
                const userDetails = prop({}),
                    userId = vnode.attrs.user_id.split('-')[0],
                    hash = prop(window.location.hash),
                    displayTabContent = (user) => {
        Severity: Minor
        Found in legacy/src/root/users-edit.js - About 1 hr to fix

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

              oninit: function(vnode) {
                  const body = document.getElementsByTagName('body')[0],
                      editLinksToggle = h.toggleProp(true, false),
                      validating = prop(false),
                      showPublish = h.toggleProp(true, false),
          Severity: Minor
          Found in legacy/src/c/project-dashboard-menu.js - About 1 hr to fix

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

                view({ attrs }) {
            
                    /** @type {AdultPopupModalAttrs} */
                    const {
                        userPublicName,
            Severity: Minor
            Found in legacy/src/c/adult-popup-modal.js - About 1 hr to fix

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

                  oninit: function(vnode) {
                      const 
                          wishedState = 'transferred',
                          userIdVM = catarse.filtersVM({user_id: 'eq', state: 'eq'}),
                          lastBalanceTransfer = catarse.paginationVM(models.balanceTransfer, 'created_at.desc', { Prefer: 'count=exact' }),
              Severity: Minor
              Found in legacy/src/c/project-successful-next-steps.js - About 1 hr to fix

                Function save has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    async save(profileImage? : File) : Promise<boolean> {
                        
                        try {
                            this.clearErrors()
                            this._isSaving = true
                Severity: Minor
                Found in legacy/src/vms/user-info-edit-vm.ts - About 1 hr to fix

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

                      view({ attrs, state }: m.Vnode<RewardsEditListAttrs, RewardsEditListState>) {
                  
                          const loading = attrs.loading
                          const error = attrs.error
                          const errors = attrs.errors
                  Severity: Minor
                  Found in legacy/src/c/projects/edit/rewards-edit-list.tsx - About 1 hr to fix

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

                        oninit: function(vnode) {
                            const vm = projectGoalVM,
                                mapErrors = [
                                      ['mode', ['mode']],
                                      ['goal', ['goal']],
                    Severity: Minor
                    Found in legacy/src/c/project-goal-edit.js - About 1 hr to fix

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

                                      _.map(localVnode.dom.children, (item) => {
                                          const toR = toRedraw[item.getAttribute('id')];
                      
                                          if (toR) {
                                              item[toR.action] = toR.actionSource;
                      Severity: Major
                      Found in legacy/src/c/dashboard-info.js and 1 other location - About 1 hr to fix
                      legacy/src/c/project-successful-onboard.js on lines 41..47

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

                      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