catarse/catarse.js

View on GitHub

Showing 570 of 1,380 total issues

Function paymentVM has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

const paymentVM = () => {
    const pagarme = prop({}),
        defaultCountryID = addressVM.defaultCountryID,
        submissionError = prop(false),
        isLoading = prop(false);
Severity: Minor
Found in legacy/src/vms/payment-vm.js - About 1 day 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 fakeRequest has 211 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function fakeRequest(global, requestTracker, stubTracker, paramParser) {
    function FakeXMLHttpRequest() {
      requestTracker.track(this);
      this.eventBus = eventBusFactory(this);
      initializeEvents(this);
Severity: Major
Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 day to fix

    Function scan has 204 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function scan(render) {
      const states = {}
      const onremovers = []
      const renderNode = renderComponents(states, onremovers)
      const api = {
    Severity: Major
    Found in legacy/spec/lib/mithril-query/mithril-query.js - About 1 day to fix

      Function userInteraction has 203 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          userInteraction(attrs) {
              const {
                  subscription,
                  displayCancelModal,
                  isGeneratingSecondSlip,
      Severity: Major
      Found in legacy/src/c/user-subscription-box-control.js - About 1 day to fix

        File user-notifications.js has 495 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import m from "mithril";
        import prop from "mithril/stream";
        import _ from "underscore";
        import h from "../h";
        import userVM from "../vms/user-vm";
        Severity: Minor
        Found in legacy/src/c/user-notifications.js - About 7 hrs to fix

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

              view: function() {
                  return m('footer.main-footer.main-footer-neg',
                      [
                          m('section.w-container',
                              m('.w-row',
          Severity: Major
          Found in legacy/src/root/footer.js - About 7 hrs to fix

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

                view: function({state, attrs}) {
                    const project = attrs.project,
                        rewards = attrs.rewardDetails;
            
                    return m('nav-wrapper', { style: attrs.style }, project() ? [
            Severity: Minor
            Found in legacy/src/c/project-tabs.js - About 7 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 193 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                oninit: function(vnode) {
                    let parsedErrors = userAboutVM.mapRailsErrors(railsErrorsVM.railsErrors());
                    let deleteUser;
                    const user = vnode.attrs.user || {},
                        fields = {
            Severity: Major
            Found in legacy/src/c/user-about-edit.js - About 7 hrs to fix

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

                  oninit: function(vnode) {
                      let deleteFormSubmit;
                      const showPreview = prop(false),
                          willSelectRewards = prop(false),
                          isProjectLoaded = prop(false),
              Severity: Major
              Found in legacy/src/root/posts.js - About 7 hrs to fix

                File edit-reward-card.js has 486 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import m from 'mithril';
                import prop from 'mithril/stream';
                import moment from 'moment';
                import _ from 'underscore';
                import h from '../h';
                Severity: Minor
                Found in legacy/src/c/edit-reward-card.js - About 7 hrs to fix

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

                      oninit: function(vnode) {
                          const vm = vnode.attrs.vm,
                              isSubscriptionEdit = vnode.attrs.isSubscriptionEdit || prop(false),
                              subscriptionEditConfirmed = prop(false),
                              showSubscriptionModal = prop(false),
                  Severity: Major
                  Found in legacy/src/c/payment-credit-card.js - About 7 hrs to fix

                    Function projectFiltersVM has 190 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const projectFiltersVM = () => {
                        const filtersVM = catarse.filtersVM,
                            covid19 = filtersVM({
                                integrations: 'like',
                            }).integrations('COVID-19'),
                    Severity: Major
                    Found in legacy/src/vms/project-filters-vm.js - About 7 hrs to fix

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

                          oninit: function(vnode) {
                              let listVM = subscriptionListVM,
                                  filterVM = subscriptionFilterVM,
                                  error = prop(''),
                                  filterBuilder = [{ // name
                      Severity: Major
                      Found in legacy/src/root/admin-subscriptions.js - About 7 hrs to fix

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

                            view: function({state, attrs}) {
                                // FIXME: MISSING ADJUSTS
                                // - add draft admin modifications
                                const reward = state.reward,
                                    project = attrs.project,
                        Severity: Minor
                        Found in legacy/src/c/project-reward-card.js - About 7 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 179 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            oninit({attrs, state} : m.Vnode<UserInfoEditSettingsAttrs, UserInfoEditSettingsState>) {
                                const hasErrorOn = attrs.hasErrorOn
                                const getErrorsOn = attrs.getErrorsOn
                                const user = attrs.user
                                user.address = user.address || {
                        Severity: Major
                        Found in legacy/src/c/projects/publish-by-steps/user-info-edit-settings.tsx - About 7 hrs to fix

                          File projects-subscription-report.js has 462 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/root/projects-subscription-report.js - About 7 hrs to fix

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

                                view: function({ state, attrs }) {
                                    const project = attrs.project;
                                    const userDetail = attrs.userDetails();
                                    const contactData = _.extend(attrs.userDetails(), { project_id: project().id });
                                    const contactModalC = [ownerMessageContent, contactData];
                            Severity: Minor
                            Found in legacy/src/c/project-user-card.js - About 7 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

                            File start.js has 458 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 models from '../models';
                            Severity: Minor
                            Found in legacy/src/root/start.js - About 7 hrs to fix

                              File payment-credit-card.js has 458 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import m from 'mithril';
                              import prop from 'mithril/stream';
                              import _ from 'underscore';
                              import h from '../h';
                              import tooltip from './tooltip';
                              Severity: Minor
                              Found in legacy/src/c/payment-credit-card.js - About 7 hrs to fix

                                File credit-card-vm.js has 448 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import _ from 'underscore';
                                import prop from 'mithril/stream';
                                
                                const { CatarseAnalytics } = window;
                                
                                
                                Severity: Minor
                                Found in legacy/src/vms/credit-card-vm.js - About 6 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language