catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

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

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

      const projectEditCard = {
          oninit: function(vnode) {
              vnode.state = {
                  user: userVM.fetchUser(vnode.attrs.user_id),
                  project: projectVM.fetchProject(vnode.attrs.project_id)
      Severity: Major
      Found in legacy/src/root/project-edit-card.js and 2 other locations - About 7 hrs to fix
      legacy/src/root/project-edit-budget.js on lines 7..23
      legacy/src/root/project-edit-video.js on lines 7..23

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

      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 3 locations. Consider refactoring.
      Open

      const projectEditBudget = {
          oninit: function(vnode) {
              vnode.state = {
                  user: userVM.fetchUser(vnode.attrs.user_id),
                  project: projectVM.fetchProject(vnode.attrs.project_id)
      Severity: Major
      Found in legacy/src/root/project-edit-budget.js and 2 other locations - About 7 hrs to fix
      legacy/src/root/project-edit-card.js on lines 7..23
      legacy/src/root/project-edit-video.js on lines 7..23

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

      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 3 locations. Consider refactoring.
      Open

      const projectEditVideo = {
          oninit: function(vnode) {
              vnode.state = {
                  user: userVM.fetchUser(vnode.attrs.user_id),
                  project: projectVM.fetchProject(vnode.attrs.project_id)
      Severity: Major
      Found in legacy/src/root/project-edit-video.js and 2 other locations - About 7 hrs to fix
      legacy/src/root/project-edit-budget.js on lines 7..23
      legacy/src/root/project-edit-card.js on lines 7..23

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

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

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

          export class UserInfoEditSettingsTips implements m.Component {
              view({attrs}) {
                  return (
                      <div class="dashboard-column-tips admin">
                          <div class="card card-secondary">
          legacy/src/c/projects/publish-by-steps/user-info-edit-public-profile-tips.tsx on lines 3..24

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

          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

          export class UserInfoEditPublicProfileTips implements m.Component {
              view({ attrs }) {
                  return (
                      <div class="dashboard-column-tips internet">
                          <div class="card card-secondary">
          legacy/src/c/projects/publish-by-steps/user-info-edit-settings-tips.tsx on lines 3..24

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

          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

          vm.withNullParameters = () => {
              const withNullVm = catarse.filtersVM({
                  full_text_index: 'plfts(portuguese)',
                  state: 'in',
                  reward_id: 'is',
          Severity: Major
          Found in legacy/src/vms/projects-contribution-report-vm.js and 1 other location - About 7 hrs to fix
          legacy/src/vms/projects-subscription-report-vm.js on lines 43..60

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

          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

          vm.withNullParameters = () => {
              const withNullVm = commonPayment.filtersVM({
                  status: 'in',
                  reward_external_id: 'is',
                  search_index: 'plfts(portuguese)',
          Severity: Major
          Found in legacy/src/vms/projects-subscription-report-vm.js and 1 other location - About 7 hrs to fix
          legacy/src/vms/projects-contribution-report-vm.js on lines 43..60

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

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

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

                              (state.showOtherBanksInput()
                                  ? m('.w-col.w-col-5.w-sub-col',
                                      m('.w-row.u-marginbottom-20[id=\'bank_search\']',
                                          m('.w-col.w-col-12', [
                                              m('.input.string.optional.user_bank_account_input_bank_number', [
              Severity: Major
              Found in legacy/src/c/user-bank-form.js and 1 other location - About 6 hrs to fix
              legacy/src/c/user-billing.js on lines 254..288

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

              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

                                              (state.showOtherBanksInput() ?
                                                  m('.w-col.w-col-6.w-sub-col',
                                                      m('.w-row.u-marginbottom-20[id=\'bank_search\']',
                                                          m('.w-col.w-col-12', [
                                                              m('.input.string.optional.user_bank_account_input_bank_number', [
              Severity: Major
              Found in legacy/src/c/user-billing.js and 1 other location - About 6 hrs to fix
              legacy/src/c/user-bank-form.js on lines 91..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 173.

              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 mapRewardsToOptions = () => {
                          let options = [];
                          if (!lReward()) {
                              options = _.map(rewards(), r => ({
                                  value: r.id,
              Severity: Major
              Found in legacy/src/root/projects-subscription-report.js and 1 other location - About 6 hrs to fix
              legacy/src/root/projects-contribution-report.js on lines 238..258

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

              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 mapRewardsToOptions = () => {
                          let options = [];
                          if (!lReward()) {
                              options = _.map(rewards(), r => ({
                                  value: r.id,
              Severity: Major
              Found in legacy/src/root/projects-contribution-report.js and 1 other location - About 6 hrs to fix
              legacy/src/root/projects-subscription-report.js on lines 226..246

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

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