catarse/catarse.js

View on GitHub

Showing 570 of 1,380 total issues

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

    view: function({state}) {
        const user = state.user(),
            survey = state.survey(),
            countryName = state.countryName,
            stateName = state.stateName,
Severity: Minor
Found in legacy/src/root/surveys-show.js - About 6 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 44 (exceeds 5 allowed). Consider refactoring.
Open

    view: function({
        state,
        attrs
    }) {
        const newFee = {
Severity: Minor
Found in legacy/src/c/edit-reward-card.js - About 6 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 a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

    oninit: function(vnode) {
        let deleteFormSubmit;
        const showPreview = prop(false),
            willSelectRewards = prop(false),
            isProjectLoaded = prop(false),
Severity: Minor
Found in legacy/src/root/posts.js - About 6 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 163 lines of code (exceeds 25 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: Major
Found in legacy/src/c/user-subscription-box.js - About 6 hrs to fix

    File projects-subscription-checkout.js has 437 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      File projects-explore-vm.ts has 432 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      type ExtendedWindow = {
          replaceDiacritics(inputText : string): string;
      }
      
      import _ from 'underscore'
      Severity: Minor
      Found in legacy/src/vms/projects-explore-vm.ts - About 6 hrs to fix

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

            oninit: function(vnode) {
                const listVM = projectListVM,
                    filterVM = projectFilterVM,
                    categories = prop([]),
                    filters = catarse.filtersVM,
        Severity: Major
        Found in legacy/src/root/admin-projects.js - About 6 hrs to fix

          File surveys-show.js has 428 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/surveys-show.js - About 6 hrs to fix

            File dashboard-reward-card.js has 425 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 copyTextInput from './copy-text-input';
            Severity: Minor
            Found in legacy/src/c/dashboard-reward-card.js - About 6 hrs to fix

              File projects-payment.js has 424 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 contributionVM from '../vms/contribution-vm';
              Severity: Minor
              Found in legacy/src/root/projects-payment.js - About 6 hrs to fix

                Function matcherFn_ has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                Open

                jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) {
                  return function() {
                    var matcherArgs = jasmine.util.argsToArray(arguments);
                    var result = matcherFunction.apply(this, arguments);
                
                
                Severity: Minor
                Found in legacy/spec/lib/jasmine/jasmine.js - About 6 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 152 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    oninit: function (vnode) {
                        const reward = vnode.attrs.reward(),
                            imageFileToUpload = prop(null),
                            isUploadingRewardImage = prop(false),
                            isDeletingRewardImage = prop(false),
                Severity: Major
                Found in legacy/src/c/dashboard-reward-card.js - About 6 hrs to fix

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

                      view({ attrs, state }: m.Vnode<DescriptionEditAttrs, DescriptionEditState>) {
                  
                          const project = attrs.project
                          const isSaving = attrs.isSaving
                          const save = attrs.save
                  Severity: Major
                  Found in legacy/src/root/projects/publish-by-steps/description-edit.tsx - About 6 hrs to fix

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

                        view: function({state}) {
                            const contribution = state.contribution,
                                contactModalC = [ownerMessageContent, {
                                    id: contribution.project_user_id,
                                    name: contribution.project_owner_name,
                    Severity: Minor
                    Found in legacy/src/c/user-contributed-box.js - About 5 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 a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                    Open

                        oninit: function(vnode) {
                            const project = projectVM.getCurrentProject(),
                                reward = vnode.attrs.reward(),
                                imageFileToUpload = prop(null),
                                minimumValue = projectVM.isSubscription(project) ? 5 : 10,
                    Severity: Minor
                    Found in legacy/src/c/edit-reward-card.js - About 5 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 posts.js has 412 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/root/posts.js - About 5 hrs to fix

                      File user-billing.js has 409 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/c/user-billing.js - About 5 hrs to fix

                        Function wrap has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function wrap(component, customAttr) {
                            if (!app) {
                                app = document.getElementById('application');
                            }
                        
                        
                        Severity: Minor
                        Found in legacy/src/wrap.js - About 5 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 a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                        Open

                            oninit: function(vnode) {
                                const MINIMUM_VALUE = 10;
                                const queryRewardValue = h.getParams('value');
                                const setInput = localVnode => localVnode.dom.focus();
                                const isSelected = currentReward => (currentReward.id == null && !rewardVM.selectedReward() && queryRewardValue) || (rewardVM.selectedReward() && currentReward.id === rewardVM.selectedReward().id);
                        Severity: Minor
                        Found in legacy/src/c/reward-select-card.js - About 5 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 142 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            oninit: function(vnode) {
                                models.bank.pageSize(false);
                                const user = vnode.attrs.user,
                                    bankAccount = prop({}),
                                    fields = {
                        Severity: Major
                        Found in legacy/src/c/user-billing.js - About 5 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language