catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

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

                        m('.w-row', [
                            m('.w-col.w-col-12.u-text-center', {
                                style: {
                                    'min-height': '300px'
                                }
Severity: Major
Found in legacy/src/c/project-insights.js and 1 other location - About 4 hrs to fix
legacy/src/c/project-insights.js on lines 236..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 133.

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

    view({state}) {
        const project = _.first(state.projectDetails());
        const reward = _.first(state.reward());
        return [
            project ? 
Severity: Major
Found in legacy/src/root/survey-create.js - About 4 hrs to fix

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

        oninit: function(vnode) {
            const loadReward = () => {
                
                const reward = prop({});
    
    
    Severity: Major
    Found in legacy/src/c/admin-subscription-detail.js - About 4 hrs to fix

      Function scan has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

      function scan(render) {
        const states = {}
        const onremovers = []
        const renderNode = renderComponents(states, onremovers)
        const api = {
      Severity: Minor
      Found in legacy/spec/lib/mithril-query/mithril-query.js - About 4 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 3 locations. Consider refactoring.
      Open

                  m('.dashboard-header',
                          m('.w-container',
                              m('.w-row', [
                                  m('.w-col.w-col-3'),
                                  m('.w-col.w-col-6', [
      Severity: Major
      Found in legacy/src/c/project-contribution-report-header.js and 2 other locations - About 4 hrs to fix
      legacy/src/root/projects-fiscal.js on lines 49..73
      legacy/src/root/surveys.js on lines 156..180

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

      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

                  m('.section',
                      m('.w-container',
                          m('.w-row', [
                              m('.w-col.w-col-2'),
                              m('.w-col.w-col-8', [
      Severity: Major
      Found in legacy/src/root/projects-fiscal.js and 2 other locations - About 4 hrs to fix
      legacy/src/c/project-contribution-report-header.js on lines 31..55
      legacy/src/root/surveys.js on lines 156..180

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

      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

                  m('.section',
                      m('.w-container',
                          m('.w-row', [
                              m('.w-col.w-col-2'),
                              m('.w-col.w-col-8', [
      Severity: Major
      Found in legacy/src/root/surveys.js and 2 other locations - About 4 hrs to fix
      legacy/src/c/project-contribution-report-header.js on lines 31..55
      legacy/src/root/projects-fiscal.js on lines 49..73

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

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

          oninit: function(vnode) {
              const {
                  ViewContentEvent,
                  AddToCartEvent
              } = projectVM;
      Severity: Major
      Found in legacy/src/root/projects-subscription-checkout.js - About 4 hrs to fix

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

            oninit: function (vnode) {
                const vm = projectBasicsVM,
                    mapErrors = [
                        ['name', ['name']],
                        ['public_tags', ['public_tags']],
        Severity: Major
        Found in legacy/src/c/project-basics-edit.js - About 4 hrs to fix

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

              private mapRailsErrors(error : RailsErrors) {
                  const railsErrorJson = JSON.parse(error.errors_json)
                  Object.keys(railsErrorJson).forEach(field => {
                      if (typeof railsErrorJson[field] === 'string') {
                          this.setErrorOnField(field, railsErrorJson[field])
          Severity: Major
          Found in legacy/src/vms/project-publish-by-steps-vm.ts and 1 other location - About 4 hrs to fix
          legacy/src/vms/user-info-edit-vm.ts on lines 233..244

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

          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

              private mapRailsErrors(error : RailsErrors) {
                  const railsErrorJson = JSON.parse(error.errors_json)
                  Object.keys(railsErrorJson).forEach(field => {
                      if (typeof railsErrorJson[field] === 'string') {
                          this.setErrorOnField(field, railsErrorJson[field])
          Severity: Major
          Found in legacy/src/vms/user-info-edit-vm.ts and 1 other location - About 4 hrs to fix
          legacy/src/vms/project-publish-by-steps-vm.ts on lines 233..244

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

          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

                      inputActions = () => m('', [
                          m('.w-inline-block', [
                              m('button.btn-inline.btn.btn-small.btn-terciary', {
                                  onclick: displayChargebackForm.toggle
                              }, 'Chargeback em massa'),
          Severity: Major
          Found in legacy/src/root/admin-subscriptions.js and 1 other location - About 4 hrs to fix
          legacy/src/root/admin-contributions.js on lines 232..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 124.

          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

                      it('should have hidden other values after selecting first one', () => {
                          currentValue = values[0];
                          component.click('.explore-span-filter', new Event('click'));
                          component.click(`a.explore-filter-link:contains("${values[1].label}")`, new Event('click'));
                          component.should.not.have(`a.explore-filter-link`);
          Severity: Major
          Found in legacy/spec/components/explore-filter-select.spec.js and 1 other location - About 4 hrs to fix
          legacy/spec/components/explore-filter-select.spec.js on lines 119..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 124.

          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

                      it('should have hidden other values after selecting first one', () => {
                          currentValue = values[0];
                          component.click('.explore-span-filter', new Event('click'));
                          component.click(`a.explore-filter-link:contains("${values[1].label}")`, new Event('click'));
                          component.should.not.have(`a.explore-filter-link`);
          Severity: Major
          Found in legacy/spec/components/explore-filter-select.spec.js and 1 other location - About 4 hrs to fix
          legacy/spec/components/explore-filter-select.spec.js on lines 60..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 124.

          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

                      inputActions = () => m('', [
                          m('.w-inline-block', [
                              m('button.btn-inline.btn.btn-small.btn-terciary', {
                                  onclick: displayChargebackForm.toggle
                              }, 'Chargeback em massa'),
          Severity: Major
          Found in legacy/src/root/admin-contributions.js and 1 other location - About 4 hrs to fix
          legacy/src/root/admin-subscriptions.js on lines 169..187

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

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

              oninit: function(vnode) {
                  const vm = projectCardVM,
                      mapErrors = [
                          ['uploaded_image', ['uploaded_image']],
                          ['cover_image', ['cover_image']],
          Severity: Minor
          Found in legacy/src/c/project-card-edit.js - About 4 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 next_ has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

          jasmine.Queue.prototype.next_ = function() {
            var self = this;
            var goAgain = true;
          
            while (goAgain) {
          Severity: Minor
          Found in legacy/spec/lib/jasmine/jasmine.js - About 4 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 renderComponents has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

          function renderComponents(states, onremovers) {
            function renderComponent(component, treePath) {
              if (isFunction(component.tag)) {
                component.instance = component.tag(component)
              } else if (isClass(component.tag)) {
          Severity: Minor
          Found in legacy/spec/lib/mithril-query/mithril-query.js - About 4 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 110 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              oninit: function(vnode) {
                  const
                      showError = prop(false),
                      loader = catarse.loaderWithToken,
                      showPreview = h.toggleProp(false, true),
          Severity: Major
          Found in legacy/src/root/survey-create.js - About 4 hrs to fix

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

                oninit: function (vnode) {
                    const { project_id, user_id } = vnode.attrs;
                    const project = projectVM.fetchProject(project_id);
                    const c_opts = { project_id, user_id, project };
                    const hash = prop(window.location.hash);
            Severity: Major
            Found in legacy/src/root/project-edit.js - About 4 hrs to fix
              Severity
              Category
              Status
              Source
              Language