catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

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

    view: function({state, attrs}) {
        const project = attrs.project(),
            projectRoute = `/projects/${project.project_id}`,
            editRoute = `${projectRoute}/edit`,
            editLinkClass = hash => `dashboard-nav-link-left ${project.is_published ? 'indent' : ''} ${h.hashMatch(hash) ? 'selected' : ''}`;
Severity: Minor
Found in legacy/src/c/project-dashboard-menu.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 oninit has 280 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    oninit: function(vnode) {
        const listVM = balanceTransferListVM,
            filterVM = balanceTransferFilterVM(),
            authorizedListVM = balanceTransferListVM,
            authorizedFilterVM = balanceTransferFilterVM(),
Severity: Major
Found in legacy/src/root/admin-balance-tranfers.js - About 1 day to fix

    Function CatarseAnalytics has 263 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    window.CatarseAnalytics = window.CatarseAnalytics || (function(){
        /*!
       * cookie-monster - a simple cookie library
       * v0.3.0
       * https://github.com/jgallen23/cookie-monster
    Severity: Major
    Found in legacy/spec/lib/analytics.js - About 1 day to fix

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

      const deliverContributionModalContent = {
          view: function({attrs}) {
              return m('div',
                  m('.modal-dialog-header',
                      m('.fontsize-large.u-text-center', [
      Severity: Major
      Found in legacy/src/c/deliver-contribution-modal-content.js and 1 other location - About 1 day to fix
      legacy/src/c/error-contribution-modal-content.js on lines 8..67

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

      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 errorContributionModalContent = {
          view: function({attrs}) {
              return m('div',
      
                  m('.modal-dialog-header',
      Severity: Major
      Found in legacy/src/c/error-contribution-modal-content.js and 1 other location - About 1 day to fix
      legacy/src/c/deliver-contribution-modal-content.js on lines 8..66

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

      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 AjaxFakeRequest has 257 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      getJasmineRequireObj().AjaxFakeRequest = function(eventBusFactory) {
        function extend(destination, source, propertiesToSkip) {
          propertiesToSkip = propertiesToSkip || [];
          for (var property in source) {
            if (!arrayContains(propertiesToSkip, property)) {
      Severity: Major
      Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 day to fix

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

                                                }, [
                                                    m('option[value=\'\']', { selected: fields.bank_id() === '' }),
                                                    (_.map(state.popularBanks, bank => (fields.bank_id() != bank.id ? m(`option[value='${bank.id}']`, {
                                                        selected: fields.bank_id() == bank.id
                                                    },
        Severity: Major
        Found in legacy/src/c/user-billing.js and 1 other location - About 1 day to fix
        legacy/src/c/user-bank-form.js on lines 68..84

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

        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('option[value=\'\']', {
                                        selected: fields.bank_id() === ''
                                    }),
                                    (_.map(state.popularBanks, bank => (fields.bank_id() !== bank.id ? m(`option[value='${bank.id}']`, {
        Severity: Major
        Found in legacy/src/c/user-bank-form.js and 1 other location - About 1 day to fix
        legacy/src/c/user-billing.js on lines 232..248

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

        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 oninit has 248 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            oninit: function (vnode) {
                const filterVM = projectsSubscriptionReportVM,
                    catarseVM = projectsContributionReportVM,
                    dropdownNumber = prop(0),
                    error = prop(false),
        Severity: Major
        Found in legacy/src/root/projects-subscription-report.js - About 1 day to fix

          File mock-ajax.js has 579 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
          
          Jasmine-Ajax - v3.1.1: a set of helpers for testing AJAX requests under the Jasmine
          BDD framework for JavaScript.
          
          
          Severity: Major
          Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 day to fix

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

                oninit: function(vnode) {
                    let listVM = contributionListVM,
                        filterVM = contributionFilterVM,
                        error = prop(''),
                        filterBuilder = [{ // full_text_index
            Severity: Major
            Found in legacy/src/root/admin-contributions.js - About 1 day to fix

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

                  oninit: function(vnode) {
                      const listVM = projectContributionsListVM(),
                          filterVM = projectsContributionReportVM,
                          project = prop([{}]),
                          rewards = prop([]),
              Severity: Major
              Found in legacy/src/root/projects-contribution-report.js - About 1 day to fix

                Function oninit has 239 lines of code (exceeds 25 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: Major
                Found in legacy/src/c/edit-reward-card.js - About 1 day to fix

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

                              anonymousCheckbox = m('.w-row', [
                                  m('.w-checkbox.w-clearfix', [
                                      m('input.w-checkbox-input[id=\'anonymous\'][name=\'anonymous\'][type=\'checkbox\']', {
                                          onclick: () => CatarseAnalytics.event({
                                              cat: 'contribution_finish',
                  Severity: Major
                  Found in legacy/src/root/projects-subscription-checkout.js and 1 other location - About 1 day to fix
                  legacy/src/root/projects-payment.js on lines 148..174

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

                  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

                              anonymousCheckbox = m('.w-row', [
                                  m('.w-checkbox.w-clearfix', [
                                      m("input.w-checkbox-input[id='anonymous'][name='anonymous'][type='checkbox']", {
                                          onclick: () =>
                                              CatarseAnalytics.event({
                  Severity: Major
                  Found in legacy/src/root/projects-payment.js and 1 other location - About 1 day to fix
                  legacy/src/root/projects-subscription-checkout.js on lines 174..200

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

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

                      view: function({state, attrs}) {
                          const project = attrs.project,
                              isSolidarityProject = state.isSolidarityProject,
                              buildTooltip = el => m(tooltip, {
                                  el,
                  Severity: Minor
                  Found in legacy/src/c/project-insights.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 userInteraction has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
                  Open

                      userInteraction(attrs) {
                          const {
                              subscription,
                              displayCancelModal,
                              isGeneratingSecondSlip,
                  Severity: Minor
                  Found in legacy/src/c/user-subscription-box-control.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

                  File i18n.js has 536 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  // I18n.js
                  // =======
                  //
                  // This small library provides the Rails I18n API on the Javascript.
                  // You don't actually have to use Rails (or even Ruby) to use I18n.js.
                  Severity: Major
                  Found in legacy/spec/lib/i18n/i18n.js - About 1 day to fix

                    File user-about-edit.js has 531 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: Major
                    Found in legacy/src/c/user-about-edit.js - About 1 day to fix

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language