catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

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

    view: function({attrs}) {
        const collection = attrs.collection,
            title = attrs.title || collection.title,
            ref = attrs.ref,
            showFriends = attrs.showFriends,
Severity: Minor
Found in legacy/src/c/project-row.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

Function format has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

jasmine.PrettyPrinter.prototype.format = function(value) {
  if (this.ppNestLevel_ > 40) {
    throw new Error('jasmine.PrettyPrinter: format() nested too deeply!');
  }

Severity: Minor
Found in legacy/spec/lib/jasmine/jasmine.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

Function compareObjects_ has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) {
  if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) {
    return true;
  }

Severity: Minor
Found in legacy/spec/lib/jasmine/jasmine.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

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

    view({attrs}) {

        /** @type {Report} */
        const {
            id,
Severity: Major
Found in legacy/src/c/project-subscription-report-download-entry.js - About 2 hrs to fix

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

        oninit: function(vnode) {
            const project = vnode.attrs.project(),
                showDetail = h.toggleProp(false, true),
                currentTab = prop('info'),
                checked = contribution => _.contains(vnode.attrs.selectedContributions(), contribution.id),
    Severity: Major
    Found in legacy/src/c/project-contribution-report-content-card.js - About 2 hrs to fix

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

                          m('.fontsize-base.u-marginbottom-20', [
                              m('span.fontweight-semibold', `${window.I18n.t('value_text', I18nScope())}:`),
                              m.trust(' '),
                              m('span.text-success',
                                  window.I18n.t('shared.currency', { amount: h.formatNumber(balance.amount, 2, 3) })
      Severity: Major
      Found in legacy/src/c/user-balance-request-modal-content.js and 1 other location - About 2 hrs to fix
      legacy/src/c/user-balance-request-modal-content.js on lines 200..206

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

      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('.fontsize-base.u-marginbottom-20', [
                                  m('span.fontweight-semibold', `${window.I18n.t('value_text', I18nScope())}:`),
                                  m.trust(' '),
                                  m('span.text-success',
                                      window.I18n.t('shared.currency', { amount: h.formatNumber(balance.amount, 2, 3) })
      Severity: Major
      Found in legacy/src/c/user-balance-request-modal-content.js and 1 other location - About 2 hrs to fix
      legacy/src/c/user-balance-request-modal-content.js on lines 152..158

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

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

          oninit: function(vnode) {
              let l;
              const loadReward = () => {
                  const model = models.rewardDetail,
                      reward_id = vnode.attrs.item.reward_id,
      Severity: Major
      Found in legacy/src/c/admin-contribution-detail.js - About 2 hrs to fix

        Function getUserRecommendedProjects has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const getUserRecommendedProjects = contribution => {
            const sample3 = _.partial(_.sample, _, 3),
                loaders = prop([]),
                collection = prop([]),
                { user_id } = h.getUser();
        Severity: Major
        Found in legacy/src/vms/user-vm.js - About 2 hrs to fix

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

                      submit = () => {
                          error(false);
                          listVM.firstPage(filterVM.parameters()).then(_ => m.redraw(), (serverError) => {
                              error(serverError.message);
                              m.redraw();
          Severity: Major
          Found in legacy/src/root/admin-subscriptions.js and 2 other locations - About 2 hrs to fix
          legacy/src/root/admin-balance-tranfers.js on lines 124..131
          legacy/src/root/admin-contributions.js on lines 123..130

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

          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(
                                              '.w-row.u-marginbottom-40',
                                              !state.showPaymentForm()
                                                  ? m(
                                                      '.w-col.w-col-push-3.w-col-6',
          Severity: Major
          Found in legacy/src/root/projects-payment.js and 1 other location - About 2 hrs to fix
          legacy/src/root/projects-subscription-checkout.js on lines 347..356

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

          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 (!_.isEmpty(states()) && !isInternational) {
                      const countryState = _.first(_.filter(states(), countryState => {
                          return exportData.fields.stateID() === countryState.id;
                      }));
                      
          Severity: Major
          Found in legacy/src/vms/address-vm.js and 1 other location - About 2 hrs to fix
          legacy/src/vms/address-vm.js on lines 79..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 85.

          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('.w-row.u-marginbottom-40', !state.showPaymentForm() ? m('.w-col.w-col-push-3.w-col-6',
                                      m('button.btn.btn-large', {
                                          onclick: () => CatarseAnalytics.event({
                                              cat: 'contribution_finish',
                                              act: 'contribution_next_click'
          Severity: Major
          Found in legacy/src/root/projects-subscription-checkout.js and 1 other location - About 2 hrs to fix
          legacy/src/root/projects-payment.js on lines 347..368

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

          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 (!_.isEmpty(states()) && !exportData.international()) {
                      const countryState = _.first(_.filter(states(), countryState => {
                          return exportData.fields.stateID() === countryState.id;
                      }));
                      
          Severity: Major
          Found in legacy/src/vms/address-vm.js and 1 other location - About 2 hrs to fix
          legacy/src/vms/address-vm.js on lines 93..101

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

          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

                      submit = () => {
                          error(false);
                          listVM.firstPage(filterVM.parameters()).then(_ => m.redraw(), (serverError) => {
                              error(serverError.message);
                              m.redraw();
          Severity: Major
          Found in legacy/src/root/admin-contributions.js and 2 other locations - About 2 hrs to fix
          legacy/src/root/admin-balance-tranfers.js on lines 124..131
          legacy/src/root/admin-subscriptions.js on lines 60..67

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

          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('option[value="-1"]', window.I18n.t('form.select_default', I18nScope())),
                                                  _.map(state.categories(), category => m('option', {
                                                      value: category.id,
                                                      selected: state.projectCategory() === category.id
          Severity: Major
          Found in legacy/src/root/sub-project-new.js and 1 other location - About 2 hrs to fix
          legacy/src/root/start.js on lines 446..449

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

          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('option[value="-1"]', window.I18n.t('form.select_default', I18nScope())),
                                              _.map(state.categories(), category => m('option', { value: category.id, selected: state.projectCategory() === category.id }, category.name))
                                          ])
          Severity: Major
          Found in legacy/src/root/start.js and 1 other location - About 2 hrs to fix
          legacy/src/root/sub-project-new.js on lines 82..88

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

          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

                      submit = () => {
                          error(false);
                          listVM.firstPage(filterVM.parameters()).then(_ => m.redraw(), (serverError) => {
                              error(serverError.message);
                              m.redraw();
          Severity: Major
          Found in legacy/src/root/admin-balance-tranfers.js and 2 other locations - About 2 hrs to fix
          legacy/src/root/admin-contributions.js on lines 123..130
          legacy/src/root/admin-subscriptions.js on lines 60..67

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

          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 reward-vm.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { catarse, commonProject } from '../api';
          import _ from 'underscore';
          import m from 'mithril';
          import prop from 'mithril/stream';
          import models from '../models';
          Severity: Minor
          Found in legacy/src/vms/reward-vm.js - About 2 hrs to fix

            File jasmine-matchers.js has 269 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*
             * Copyright © 2013 Jamie Mason, @fold_left,
             * https://github.com/JamieMason
             *
             * Permission is hereby granted, free of charge, to any person
            Severity: Minor
            Found in legacy/spec/lib/jasmine-matchers.js - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language