catarse/catarse.js

View on GitHub

Showing 1,380 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

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

                      it('should find projects with mode flex', (done) => {
                          const projectsExploreVM = new ProjectsExploreViewModel({
                              mode: 'flex',
                              category_id: null,
                              searchParam: null,
          Severity: Major
          Found in legacy/spec/components/vms/projects-explore-vm.spec.js and 1 other location - About 6 hrs to fix
          legacy/spec/components/vms/projects-explore-vm.spec.js on lines 89..106

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

          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

                      it('should find projects with mode sub', (done) => {
                          const projectsExploreVM = new ProjectsExploreViewModel({
                              mode: 'sub',
                              category_id: null,
                              searchParam: null,
          Severity: Major
          Found in legacy/spec/components/vms/projects-explore-vm.spec.js and 1 other location - About 6 hrs to fix
          legacy/spec/components/vms/projects-explore-vm.spec.js on lines 108..125

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

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

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

                  const kondutoExecute = function () {
                      const customerID = h.getUserCommonID();
                  
                      if (customerID) {
                          var period = 300;
                  Severity: Major
                  Found in legacy/src/vms/common-payment-vm.js and 1 other location - About 6 hrs to fix
                  legacy/src/vms/payment-vm.js on lines 248..266

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

                  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 kondutoExecute = function () {
                          const customerID = h.getUserID();
                  
                          if (customerID) {
                              var period = 300;
                  Severity: Major
                  Found in legacy/src/vms/payment-vm.js and 1 other location - About 6 hrs to fix
                  legacy/src/vms/common-payment-vm.js on lines 172..190

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

                  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('.u-text-center', {
                                          style: {
                                              'min-height': '300px'
                                          }
                                      }, [!state.lSubscriptionsPerDay() ? m(projectDataChart, {
                  Severity: Major
                  Found in legacy/src/c/project-insights-sub.js and 1 other location - About 6 hrs to fix
                  legacy/src/c/project-insights-sub.js on lines 261..272

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

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

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

                                        m('.u-text-center', {
                                            style: {
                                                'min-height': '300px'
                                            }
                                        }, [!state.lSubscriptionsPerDay() ? m(projectDataChart, {
                    Severity: Major
                    Found in legacy/src/c/project-insights-sub.js and 1 other location - About 6 hrs to fix
                    legacy/src/c/project-insights-sub.js on lines 249..260

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

                    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

                                if (subscription.last_payment_data.status === 'refused' && subscription.payment_method != 'boleto') {
                                    return [
                                        m('.card-alert.u-radius.fontsize-smaller.u-marginbottom-10.fontweight-semibold',
                                            m('div', [
                                                m('span.fa.fa-exclamation-triangle', '.'),
                    Severity: Major
                    Found in legacy/src/c/user-subscription-box-control.js and 1 other location - About 5 hrs to fix
                    legacy/src/c/user-subscription-box-control.js on lines 143..221

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language