catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

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

getJasmineRequireObj().AjaxEventBus = function(eventFactory) {
  function EventBus(source) {
    this.eventList = {};
    this.source = source;
  }
Severity: Minor
Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 hr to fix

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

                (state.displayChargebackConfirmationModal() ? m(modalBox, {
                    displayModal: state.displayChargebackConfirmationModal,
                    content: state.chargebackConfirmationModalContentWrapper({
                        modalTitle: 'Aprovar chargebacks',
                        ctaText: 'Aprovar',
    Severity: Major
    Found in legacy/src/root/admin-subscriptions.js and 4 other locations - About 1 hr to fix
    legacy/src/root/admin-balance-tranfers.js on lines 343..351
    legacy/src/root/admin-balance-tranfers.js on lines 352..360
    legacy/src/root/admin-balance-tranfers.js on lines 361..369
    legacy/src/root/admin-contributions.js on lines 273..281

    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

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

                (state.displayApprovalModal() ? m(modalBox, {
                    displayModal: state.displayApprovalModal,
                    content: state.generateWrapperModal({
                        modalTitle: 'Aprovar saques',
                        ctaText: 'Aprovar',
    Severity: Major
    Found in legacy/src/root/admin-balance-tranfers.js and 4 other locations - About 1 hr to fix
    legacy/src/root/admin-balance-tranfers.js on lines 352..360
    legacy/src/root/admin-balance-tranfers.js on lines 361..369
    legacy/src/root/admin-contributions.js on lines 273..281
    legacy/src/root/admin-subscriptions.js on lines 211..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 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

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

                (state.displayChargebackConfirmationModal() ? m(modalBox, {
                    displayModal: state.displayChargebackConfirmationModal,
                    content: state.chargebackConfirmationModalContentWrapper({
                        modalTitle: 'Aprovar chargebacks',
                        ctaText: 'Aprovar',
    Severity: Major
    Found in legacy/src/root/admin-contributions.js and 4 other locations - About 1 hr to fix
    legacy/src/root/admin-balance-tranfers.js on lines 343..351
    legacy/src/root/admin-balance-tranfers.js on lines 352..360
    legacy/src/root/admin-balance-tranfers.js on lines 361..369
    legacy/src/root/admin-subscriptions.js on lines 211..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 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

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

                (state.displayRejectModal() ? m(modalBox, {
                    displayModal: state.displayRejectModal,
                    content: state.generateWrapperModal({
                        modalTitle: 'Rejeitar saques',
                        ctaText: 'Rejeitar',
    Severity: Major
    Found in legacy/src/root/admin-balance-tranfers.js and 4 other locations - About 1 hr to fix
    legacy/src/root/admin-balance-tranfers.js on lines 343..351
    legacy/src/root/admin-balance-tranfers.js on lines 352..360
    legacy/src/root/admin-contributions.js on lines 273..281
    legacy/src/root/admin-subscriptions.js on lines 211..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 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

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

        view({state} : m.Vnode<HeaderMenuSearchAttrs, HeaderMenuSearchState>) {
            
            const searchParam = state.searchParam
    
            return m('span#menu-search', [
    Severity: Minor
    Found in legacy/src/c/header-menu-search.ts - About 1 hr to fix

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

              const addressChange = fn => e => {
                  CatarseAnalytics.oneTimeEvent({
                      cat: 'contribution_finish',
                      act: vm.isInternational ? 'contribution_address_br' : 'contribution_address_int',
                  });
      Severity: Major
      Found in legacy/src/root/projects-payment.js and 1 other location - About 1 hr to fix
      legacy/src/root/projects-subscription-checkout.js on lines 118..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 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

      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/project-successful-onboard.js and 1 other location - About 1 hr to fix
      legacy/src/c/dashboard-info.js on lines 23..29

      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

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

        function ParamParser() {
          var defaults = [
            {
              test: function(xhr) {
                return (/^application\/json/).test(xhr.contentType());
      Severity: Minor
      Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 hr to fix

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

            createBasicPaginationVMWithAutoRedraw = vmInstance => {
                const error = prop(false);
                const errorMessage = prop('');
        
                return {
        Severity: Minor
        Found in legacy/src/h.ts - About 1 hr to fix

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

                  const addressChange = fn => (e) => {
                      CatarseAnalytics.oneTimeEvent({
                          cat: 'contribution_finish',
                          act: vm.isInternational ? 'contribution_address_br' : 'contribution_address_int'
                      });
          Severity: Major
          Found in legacy/src/root/projects-subscription-checkout.js and 1 other location - About 1 hr to fix
          legacy/src/root/projects-payment.js on lines 84..93

          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

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

          const goalsLoader = (projectId) => {
              vm.project_id(projectId);
              vm.order({
                  value: 'asc'
              });
          Severity: Major
          Found in legacy/src/vms/project-goals-vm.js and 1 other location - About 1 hr to fix
          legacy/src/vms/project-subscriptions-vm.js on lines 13..20

          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

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

                      (state.displayManualModal() ? m(modalBox, {
                          displayModal: state.displayManualModal,
                          content: state.generateWrapperModal({
                              modalTitle: 'Transferencia manual de saques',
                              ctaText: 'Aprovar',
          Severity: Major
          Found in legacy/src/root/admin-balance-tranfers.js and 4 other locations - About 1 hr to fix
          legacy/src/root/admin-balance-tranfers.js on lines 343..351
          legacy/src/root/admin-balance-tranfers.js on lines 361..369
          legacy/src/root/admin-contributions.js on lines 273..281
          legacy/src/root/admin-subscriptions.js on lines 211..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 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

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

          const subscriptionsLoader = (uuID) => {
              vm.project_id(uuID);
              vm.order({
                  created_at: 'desc'
              });
          Severity: Major
          Found in legacy/src/vms/project-subscriptions-vm.js and 1 other location - About 1 hr to fix
          legacy/src/vms/project-goals-vm.js on lines 14..21

          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

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

              oninit: function(vnode) {
                  const {
                      ViewContentEvent,
                      PurchaseEvent
                  } = projectVM;
          Severity: Minor
          Found in legacy/src/root/thank-you.js - About 1 hr to fix

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

                oninit: function(vnode) {
                    const project = vnode.attrs.project,
                        animateProgress = localVnode => {
                            let animation,
                                progress = 0,
            Severity: Minor
            Found in legacy/src/c/project-sidebar.js - About 1 hr to fix

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

                  view: function({state}) {
              
                      const project = _.first(state.projectDetails());
                      const canBeCreated = reward => !reward.survey_sent_at && ((reward.maximum_contributions && (reward.paid_count >= reward.maximum_contributions)) || project.state !== 'online');
                      const cannotBeCreated = reward => !reward.survey_sent_at && project.state === 'online' && (!reward.maximum_contributions || (reward.paid_count < reward.maximum_contributions));
              Severity: Minor
              Found in legacy/src/root/surveys.js - About 1 hr 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 a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  view: function({state, attrs}) {
                      
                      const user = state.user();
              
                      if (user) {
              Severity: Minor
              Found in legacy/src/root/check-email.js - About 1 hr 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 a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  oninit: function (vnode) {
              
                      const explitInArraysOf3 = (collection) => {
                          const array = [];
                          let partArray = []; 
              Severity: Minor
              Found in legacy/src/c/user-balance-withdraw-history.js - About 1 hr 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 a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  view: function({attrs}) {
                      const project = attrs.project() || {},
                          onlineDays = () => {
                              const diff = moment(project.zone_online_date).diff(moment(project.zone_expires_at)),
                                  duration = moment.duration(diff);
              Severity: Minor
              Found in legacy/src/c/project-about.js - About 1 hr 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