catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

File admin-project-detail.js has 304 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import m from 'mithril';
import prop from 'mithril/stream';
import _ from 'underscore';
import {
    catarse,
Severity: Minor
Found in legacy/src/c/admin-project-detail.js - About 3 hrs to fix

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

        view({ state, attrs }) {
    
            const onSend = attrs.onSend;
            const onClose = attrs.onClose;
            const isSending = attrs.isSending();
    Severity: Major
    Found in legacy/src/c/select-subscription-reports.js - About 3 hrs to fix

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

          view: function({state, attrs}) {
              const project = state.project();
              const user = h.getUser();
              const projectUser = state.projectUser();
      
      
      Severity: Minor
      Found in legacy/src/root/projects-subscription-thank-you.js - About 3 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 a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          view: function({state, attrs}) {
              const user = attrs.user || {},
                  fields = state.fields;
      
              return m('#about-tab.content', [
      Severity: Minor
      Found in legacy/src/c/user-about-edit.js - About 3 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

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

              if (state.subHomeWith6()) {
                  return m(
                      'div',
                      _.map(state.aonAndFlex_Sub_6, (collection, index) =>
                          m(projectRowWithHeader, {
      Severity: Major
      Found in legacy/src/c/projects-display.js and 1 other location - About 3 hrs to fix
      legacy/src/c/projects-display.js on lines 106..131

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

      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

              } else if (state.subHomeWith3()) {
                  return m(
                      'div',
                      _.map(state.aonAndFlex_Sub_3, (collection, index) =>
                          m(projectRowWithHeader, {
      Severity: Major
      Found in legacy/src/c/projects-display.js and 1 other location - About 3 hrs to fix
      legacy/src/c/projects-display.js on lines 93..131

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

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

      getJasmineRequireObj().AjaxRequestStub = function() {
        var RETURN = 0,
            ERROR = 1,
            TIMEOUT = 2;
      
      
      Severity: Minor
      Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 3 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

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

                  }, { // gateway
                      component: filterDropdown,
                      data: {
                          label: 'gateway',
                          name: 'gateway',
      Severity: Major
      Found in legacy/src/root/admin-contributions.js and 1 other location - About 3 hrs to fix
      legacy/src/root/admin-contributions.js on lines 30..53

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

      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

                  }, { // delivery_status
                      component: filterDropdown,
                      data: {
                          label: 'Status da entrega',
                          name: 'delivery_status',
      Severity: Major
      Found in legacy/src/root/admin-contributions.js and 1 other location - About 3 hrs to fix
      legacy/src/root/admin-contributions.js on lines 85..108

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

      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 projects-contribution-report.js has 299 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import m from 'mithril';
      import prop from 'mithril/stream';
      import _ from 'underscore';
      import { catarse } from '../api';
      import models from '../models';
      Severity: Minor
      Found in legacy/src/root/projects-contribution-report.js - About 3 hrs to fix

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

                vm.fetchUser().then(() => {
                    countriesLoader
                        .load()
                        .then((countryData) => {
                            vm.fields.address().countries(_.sortBy(countryData, 'name_en'));
        Severity: Major
        Found in legacy/src/root/projects-payment.js and 1 other location - About 3 hrs to fix
        legacy/src/root/projects-subscription-checkout.js on lines 135..144

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

        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

                vm.fetchUser().then(() => {
        
                    countriesLoader
                        .load()
                        .then((countryData) => {
        Severity: Major
        Found in legacy/src/root/projects-subscription-checkout.js and 1 other location - About 3 hrs to fix
        legacy/src/root/projects-payment.js on lines 112..120

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

        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 project-insights.js has 297 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import m from 'mithril';
        import prop from 'mithril/stream';
        import { catarse } from '../api';
        import _ from 'underscore';
        import h from '../h';
        Severity: Minor
        Found in legacy/src/c/project-insights.js - About 3 hrs to fix

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

              view: function({state, attrs}) {
                  const vmIsLoading = attrs.vm.isLoading;
                  const newSubscription = attrs.attrs;
                  const oldSubscription = attrs.attrs.oldSubscription;
          
          
          Severity: Minor
          Found in legacy/src/c/subscription-edit-modal.js - About 3 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 a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              view: function ({ state, attrs }) {
                  const vm = state.vm;
                  
                  return m('#basics-tab', [
                      state.showSuccess()
          Severity: Minor
          Found in legacy/src/c/project-basics-edit.js - About 3 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 sendCreditCardPayment has 77 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const sendCreditCardPayment = (selectedCreditCard, fields, commonData, addVM) => {
          
              if (!fields) {
                  return false;
              }
          Severity: Major
          Found in legacy/src/vms/common-payment-vm.js - About 3 hrs to fix

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

                                                    m('.fontsize-small.w-radio', [
                                                        m(`input.w-radio-input[type=radio][value='public']`, {
                                                            checked: recipients() === 'public',
                                                            onchange: m.withAttr('value', recipients)
                                                        }),
            Severity: Major
            Found in legacy/src/root/posts.js and 1 other location - About 3 hrs to fix
            legacy/src/root/posts.js on lines 310..318

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

            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('.fontsize-small.w-radio', [
                                                        m(`input.w-radio-input[type=radio][value='backers']`, {
                                                            checked: recipients() === 'backers',
                                                            onchange: m.withAttr('value', recipients)
                                                        }),
            Severity: Major
            Found in legacy/src/root/posts.js and 1 other location - About 3 hrs to fix
            legacy/src/root/posts.js on lines 299..307

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

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

            import m from 'mithril';
            import prop from 'mithril/stream';
            import { catarse } from '../api';
            import _ from 'underscore';
            import moment from 'moment';
            Severity: Minor
            Found in legacy/src/root/surveys.js - About 3 hrs to fix

              File admin-contributions.js has 293 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import m from 'mithril';
              import prop from 'mithril/stream';
              import h from '../h';
              import models from '../models';
              import { catarse } from '../api';
              Severity: Minor
              Found in legacy/src/root/admin-contributions.js - About 3 hrs to fix
                Severity
                Category
                Status
                Source
                Language