catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

File project-insights-sub.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import m from 'mithril';
import prop from 'mithril/stream';
import moment, { min } from 'moment';
import _ from 'underscore';
import { catarse, catarseMoments, commonAnalytics } from '../api';
Severity: Minor
Found in legacy/src/c/project-insights-sub.js - About 2 hrs to fix

    File user-bank-form.js has 266 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';
    
    
    Severity: Minor
    Found in legacy/src/c/user-bank-form.js - About 2 hrs to fix

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

          oninit(/** @type {VNode} */vnode) {
               
              /**
               * @param {string} name
               * @param {ProjectIntegration[]} integrations
      Severity: Major
      Found in legacy/src/root/project-edit-integrations.js - About 2 hrs to fix

        File analytics.js has 265 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        //evitamos criar duas vezes...
        //tem q ser não dependente de outros codigos
        window.CatarseAnalytics = window.CatarseAnalytics || (function(){
            /*!
           * cookie-monster - a simple cookie library
        Severity: Minor
        Found in legacy/spec/lib/analytics.js - About 2 hrs to fix

          Function view has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              view({attrs, state} : m.Vnode<UserInfoEditAttrs, UserInfoEditState>) {
                  const user = attrs.user
                  const save = attrs.save
                  const isSaving = attrs.isSaving
                  const hasErrorOn = attrs.hasErrorOn
          Severity: Major
          Found in legacy/src/root/projects/publish-by-steps/user-info-edit.tsx - About 2 hrs to fix

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

                    it('should create 2 level object with overlap', function () {
                        const obj1 = defineDeepObject('test.test', true);
                        const obj2 = defineDeepObject('test.test1', true, obj1);
                        expect(obj2.test.test).toBeTrue();
                        expect(obj2.test.test1).toBeTrue();
            Severity: Major
            Found in legacy/spec/helpers/deep-object-operators.spec.js and 1 other location - About 2 hrs to fix
            legacy/spec/helpers/deep-object-operators.spec.js on lines 22..27

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

            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

                        {
                            "user_id":3,
                            "amount":1000,
                            "funding_estimated_date":"2018-09-17T20:12:51.046076",
                            "status":"rejected",
            legacy/spec/lib/mocks/user-balance-withdraw-history-item.mock.js on lines 5..22

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

            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

                        {
                            "user_id":3,
                            "amount":1000,
                            "funding_estimated_date":"2018-09-17T20:12:51.046076",
                            "status":"pending",
            legacy/spec/lib/mocks/user-balance-withdraw-history-item.mock.js on lines 23..40

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

            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 create 2 level object with 2 propreties', function () {
                        const obj1 = defineDeepObject('test.test', true);
                        const obj2 = defineDeepObject('test1.test1', true, obj1);
                        expect(obj2.test.test).toBeTrue();
                        expect(obj2.test1.test1).toBeTrue();
            Severity: Major
            Found in legacy/spec/helpers/deep-object-operators.spec.js and 1 other location - About 2 hrs to fix
            legacy/spec/helpers/deep-object-operators.spec.js on lines 29..34

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

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

                                                        <div class="w-col w-col-4 w-col-tiny-4">
                                                            <a href='#share' onclick={facebookShare} class="link-hidden-dark fontsize-small w-inline-block">
                                                                <div class="fa fa-facebook-square fa-2x" aria-hidden="true"></div>
                                                                <div>Facebook</div>
                                                            </a>
            Severity: Major
            Found in legacy/src/root/projects/publish-by-steps/share.tsx and 3 other locations - About 2 hrs to fix
            legacy/src/root/projects/publish-by-steps/share.tsx on lines 81..86
            legacy/src/root/projects/publish-by-steps/share.tsx on lines 95..100
            legacy/src/root/projects/publish-by-steps/share.tsx on lines 101..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 82.

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

                                                        <div class="w-col w-col-4 w-col-tiny-4">
                                                            <a target='_blank' href={twitterShareLink} class="link-hidden-dark fontsize-small w-inline-block">
                                                                <div class="fa fa-2x fa-twitter" aria-hidden="true"></div>
                                                                <div>Twitter</div>
                                                            </a>
            Severity: Major
            Found in legacy/src/root/projects/publish-by-steps/share.tsx and 3 other locations - About 2 hrs to fix
            legacy/src/root/projects/publish-by-steps/share.tsx on lines 75..80
            legacy/src/root/projects/publish-by-steps/share.tsx on lines 81..86
            legacy/src/root/projects/publish-by-steps/share.tsx on lines 101..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 82.

            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 tryDispatchErrorDisplay() {
                    if (this.hasError()) {
                        for (const field of Object.keys(this._errors)) {
                            this._errorObserver.next({ field, messages: this._errors[field] })
                            return
            Severity: Major
            Found in legacy/src/vms/project-publish-by-steps-vm.ts and 1 other location - About 2 hrs to fix
            legacy/src/vms/user-info-edit-vm.ts on lines 121..128

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

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

                                                        <div class="w-col w-col-4 w-col-tiny-4">
                                                            <a href='#share' onclick={messengerShare} class="link-hidden-dark fontsize-small w-inline-block">
                                                                <div class="fab fa-2x fa-facebook-messenger" aria-hidden="true"></div>
                                                                <div>Messenger</div>
                                                            </a>
            Severity: Major
            Found in legacy/src/root/projects/publish-by-steps/share.tsx and 3 other locations - About 2 hrs to fix
            legacy/src/root/projects/publish-by-steps/share.tsx on lines 75..80
            legacy/src/root/projects/publish-by-steps/share.tsx on lines 95..100
            legacy/src/root/projects/publish-by-steps/share.tsx on lines 101..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 82.

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

                                                        <div class="w-col w-col-4 w-col-tiny-4">
                                                            <a target='_blank' href={emailShareLink} class="link-hidden-dark fontsize-small w-inline-block">
                                                                <div class="far fa-2x fa-envelope" aria-hidden="true"></div>
                                                                <div>Email</div>
                                                            </a>
            Severity: Major
            Found in legacy/src/root/projects/publish-by-steps/share.tsx and 3 other locations - About 2 hrs to fix
            legacy/src/root/projects/publish-by-steps/share.tsx on lines 75..80
            legacy/src/root/projects/publish-by-steps/share.tsx on lines 81..86
            legacy/src/root/projects/publish-by-steps/share.tsx on lines 95..100

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

            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 tryDispatchErrorDisplay() {
                    if (this.hasError()) {
                        for (const field of Object.keys(this._errors)) {
                            this._errorObserver.next({ field, messages: this._errors[field] })
                            return
            Severity: Major
            Found in legacy/src/vms/user-info-edit-vm.ts and 1 other location - About 2 hrs to fix
            legacy/src/vms/project-publish-by-steps-vm.ts on lines 158..165

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

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

                oninit: function(vnode) {
            
                    const {
                        ViewContentEvent,
                        SubscribeEvent
            Severity: Major
            Found in legacy/src/root/projects-subscription-thank-you.js - About 2 hrs to fix

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

                          toggleDelivery = (projectId, contribution) => {
                              userVM.toggleDelivery(projectId, contribution).then(() => {
                                  const lastStatus = contribution.reward_sent_at ? 'delivered' : 'undelivered';
                                  contribution.delivery_status = contribution.delivery_status === 'received' ? lastStatus : 'received'; // so we don't have to reload the page
                              });
              Severity: Major
              Found in legacy/src/c/user-contributed-box.js and 1 other location - About 2 hrs to fix
              legacy/src/c/reward-receiver.js on lines 7..12

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

              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

                      const toggleDelivery = (projectId, contribution) => {
                          userVM.toggleDelivery(projectId, contribution).then(() => {
                              const lastStatus = contribution.reward_sent_at ? 'delivered' : 'undelivered';
                              contribution.delivery_status = contribution.delivery_status === 'received' ? lastStatus : 'received'; // so we don't have to reload the page
                          });
              Severity: Major
              Found in legacy/src/c/reward-receiver.js and 1 other location - About 2 hrs to fix
              legacy/src/c/user-contributed-box.js on lines 18..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 81.

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

                  view: function() {
                      return m('div', [
                          m('.modal-dialog-header', [
                              m('.fontsize-large.u-text-center',
                                  'Status da entrega')
              Severity: Major
              Found in legacy/src/c/project-contribution-delivery-legend-modal.js - About 2 hrs to fix

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

                    view: function({state, attrs}) {
                        const user = state.userDetails();
                
                        return m('div', [
                            m(userHeader, {
                Severity: Minor
                Found in legacy/src/root/users-edit.js - About 2 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

                Severity
                Category
                Status
                Source
                Language