catarse/catarse.js

View on GitHub
legacy/src/root/projects-subscription-report.js

Summary

Maintainability
F
4 days
Test Coverage

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

          oninit: function (vnode) {
              const filterVM = projectsSubscriptionReportVM,
                  catarseVM = projectsContributionReportVM,
                  dropdownNumber = prop(0),
                  error = prop(false),
      Severity: Minor
      Found in legacy/src/root/projects-subscription-report.js - About 1 hr 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

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

              vnode.state = {
                  filterVM,
                  mapRewardsToOptions,
                  filterBuilder,
                  submit,
      Severity: Major
      Found in legacy/src/root/projects-subscription-report.js and 2 other locations - About 2 hrs to fix
      legacy/src/c/dashboard-reward-card.js on lines 160..176
      legacy/src/c/user-billing.js on lines 147..163

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

      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

                          options: [{
                              value: '',
                              option: 'Todos'
                          },
                          {
      Severity: Major
      Found in legacy/src/root/projects-subscription-report.js and 1 other location - About 2 hrs to fix
      legacy/src/root/admin-projects.js on lines 37..55

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

      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

                      if (filterVM.reward_external_id() === 'null') {
                          subscriptions.firstPage(filterVM.withNullParameters());
                      } else {
                          subscriptions.firstPage(filterVM.parameters());
                      }
      Severity: Major
      Found in legacy/src/root/projects-subscription-report.js and 1 other location - About 1 hr to fix
      legacy/src/root/projects-contribution-report.js on lines 88..92

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

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

              const lReward = catarse.loaderWithToken(models.rewardDetail.getPageOptions({
                  project_id: `eq.${catarseVM.project_id()}`
              }));
      Severity: Major
      Found in legacy/src/root/projects-subscription-report.js and 4 other locations - About 40 mins to fix
      legacy/src/root/projects-contribution-report.js on lines 217..221
      legacy/src/root/projects-contribution-report.js on lines 222..226
      legacy/src/root/projects-subscription-report-download.js on lines 22..24
      legacy/src/root/projects-subscription-report.js on lines 248..250

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

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

              const lProject = catarse.loaderWithToken(models.projectDetail.getPageOptions({
                  project_id: `eq.${catarseVM.project_id()}`
              }));
      Severity: Major
      Found in legacy/src/root/projects-subscription-report.js and 4 other locations - About 40 mins to fix
      legacy/src/root/projects-contribution-report.js on lines 217..221
      legacy/src/root/projects-contribution-report.js on lines 222..226
      legacy/src/root/projects-subscription-report-download.js on lines 22..24
      legacy/src/root/projects-subscription-report.js on lines 217..219

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

      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

              lReward.load().then((loadedRewards) => {
                  rewards(loadedRewards);
                  isRewardsDataLoaded(true);
                  m.redraw();
              });
      Severity: Minor
      Found in legacy/src/root/projects-subscription-report.js and 2 other locations - About 40 mins to fix
      legacy/src/root/posts.js on lines 148..152
      legacy/src/root/projects-subscription-report-download.js on lines 26..30

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

      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

      There are no issues that match your filters.

      Category
      Status