catarse/catarse.js

View on GitHub

Showing 570 of 1,380 total issues

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

    view: function({state, attrs}) {
        // @TODO: remove all those things from the view
        const project = attrs.project,
            elapsed = project().elapsed_time,
            remaining = project().remaining_time,
Severity: Minor
Found in legacy/src/c/project-sidebar.js - About 4 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 119 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    view({state}) {
        const project = _.first(state.projectDetails());
        const reward = _.first(state.reward());
        return [
            project ? 
Severity: Major
Found in legacy/src/root/survey-create.js - About 4 hrs to fix

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

        oninit: function(vnode) {
            const loadReward = () => {
                
                const reward = prop({});
    
    
    Severity: Major
    Found in legacy/src/c/admin-subscription-detail.js - About 4 hrs to fix

      Function scan has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

      function scan(render) {
        const states = {}
        const onremovers = []
        const renderNode = renderComponents(states, onremovers)
        const api = {
      Severity: Minor
      Found in legacy/spec/lib/mithril-query/mithril-query.js - About 4 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 oninit has 118 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          oninit: function(vnode) {
              const {
                  ViewContentEvent,
                  AddToCartEvent
              } = projectVM;
      Severity: Major
      Found in legacy/src/root/projects-subscription-checkout.js - About 4 hrs to fix

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

            oninit: function (vnode) {
                const vm = projectBasicsVM,
                    mapErrors = [
                        ['name', ['name']],
                        ['public_tags', ['public_tags']],
        Severity: Major
        Found in legacy/src/c/project-basics-edit.js - About 4 hrs to fix

          Function oninit has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

              oninit: function(vnode) {
                  const vm = projectCardVM,
                      mapErrors = [
                          ['uploaded_image', ['uploaded_image']],
                          ['cover_image', ['cover_image']],
          Severity: Minor
          Found in legacy/src/c/project-card-edit.js - About 4 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 next_ has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

          jasmine.Queue.prototype.next_ = function() {
            var self = this;
            var goAgain = true;
          
            while (goAgain) {
          Severity: Minor
          Found in legacy/spec/lib/jasmine/jasmine.js - About 4 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 renderComponents has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

          function renderComponents(states, onremovers) {
            function renderComponent(component, treePath) {
              if (isFunction(component.tag)) {
                component.instance = component.tag(component)
              } else if (isClass(component.tag)) {
          Severity: Minor
          Found in legacy/spec/lib/mithril-query/mithril-query.js - About 4 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 oninit has 110 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              oninit: function(vnode) {
                  const
                      showError = prop(false),
                      loader = catarse.loaderWithToken,
                      showPreview = h.toggleProp(false, true),
          Severity: Major
          Found in legacy/src/root/survey-create.js - About 4 hrs to fix

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

                oninit: function (vnode) {
                    const { project_id, user_id } = vnode.attrs;
                    const project = projectVM.fetchProject(project_id);
                    const c_opts = { project_id, user_id, project };
                    const hash = prop(window.location.hash);
            Severity: Major
            Found in legacy/src/root/project-edit.js - About 4 hrs to fix

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

                  view: function({state, attrs}) {
                      const reward = state.normalReward(attrs.reward);
              
                      return (h.rewardSouldOut(reward) ? m('') : m('span.radio.w-radio.w-clearfix.back-reward-radio-reward', {
                          class: state.isSelected(reward) ? 'selected' : '',
              Severity: Minor
              Found in legacy/src/c/reward-select-card.js - About 4 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 oninit has 105 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  oninit: function(vnode) {
                      const filtersVM = vnode.attrs.filtersVM,
                          visitorsTotal = prop(0),
                          visitorLoader = catarseMoments.loaderWithToken,
                          loader = commonAnalytics.loaderWithToken,
              Severity: Major
              Found in legacy/src/c/project-insights-sub.js - About 4 hrs to fix

                File admin-balance-tranfers.js has 340 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import m from 'mithril';
                import prop from 'mithril/stream';
                import h from '../h';
                import _ from 'underscore';
                import balanceTransferListVM from '../vms/balance-transfer-list-vm';
                Severity: Minor
                Found in legacy/src/root/admin-balance-tranfers.js - About 4 hrs to fix

                  File common-payment-vm.js has 340 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import m from 'mithril';
                  import prop from 'mithril/stream';
                  import _ from 'underscore';
                  import projectVM from '../vms/project-vm';
                  import addressVM from '../vms/address-vm';
                  Severity: Minor
                  Found in legacy/src/vms/common-payment-vm.js - About 4 hrs to fix

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

                        oninit: function(vnode) {
                            h.analytics.windowScroll({ cat: 'project_start', act: 'start_page_scroll' });
                            const stats = prop([]),
                                categories = prop([]),
                                selectedPane = prop(0),
                    Severity: Major
                    Found in legacy/src/root/start.js - About 4 hrs to fix

                      Function oninit has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                      Open

                          oninit: function(vnode) {
                              const subscription = vnode.attrs.subscription,
                                  displayModal = h.toggleProp(false, true),
                                  displayCancelModal = h.toggleProp(false, true),
                                  displayPaymentHistoryModal = h.toggleProp(false, true),
                      Severity: Minor
                      Found in legacy/src/c/user-subscription-box.js - About 4 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 addressVM has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const addressVM = (args) => {
                          const data = args.data;
                          const international = prop();
                          const statesLoader = catarse.loader(models.state.getPageOptions());
                      
                      
                      Severity: Minor
                      Found in legacy/src/vms/address-vm.js - About 4 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 oninit has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          oninit: function (vnode) {
                              let parsedErrors = userSettingsVM.mapRailsErrors(vnode.attrs.rails_errors);
                              const user = vnode.attrs.user;
                              const fields = {
                                  agency: prop(''),
                      Severity: Major
                      Found in legacy/src/c/user-balance-request-modal-content.js - About 4 hrs to fix

                        Function htmlentities has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function htmlentities(text) {
                            return text
                            .replace(/\"/gi, '"')
                            .replace(/\'/gi, '\'')
                            .replace(/\&/gi, '&')
                        Severity: Major
                        Found in legacy/vendor/mithril-generative-trust.js - About 4 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language