catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

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

        const applyDocumentMask = value => {
            if (value.length > 14) {
                isCnpj(true);
                vm.fields.ownerDocument(documentCompanyMask(value));
            } else {
Severity: Major
Found in legacy/src/root/projects-payment.js and 1 other location - About 2 hrs to fix
legacy/src/root/projects-subscription-checkout.js on lines 108..116

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

                                    m('.w-col.w-col-6.w-sub-col', [
                                        m('label.fontsize-smaller', 'Seu nome'),
                                        m(`input.w-input.text-field[value='${state.from_name()}'][type='text'][required='required']`, {
                                            onchange: m.withAttr('value', state.from_name),
                                            class: h.validate().hasError(state.from_name) ? 'error' : '',
Severity: Major
Found in legacy/src/c/owner-message-content.js and 1 other location - About 2 hrs to fix
legacy/src/c/owner-message-content.js on lines 115..121

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

                                    m('.w-col.w-col-6', [
                                        m('label.fontsize-smaller', 'Seu email'),
                                        m(`input.w-input.text-field[value='${state.from_email()}'][type='text'][required='required']`, {
                                            onchange: m.withAttr('value', state.from_email),
                                            class: h.validate().hasError(state.from_email) ? 'error' : '',
Severity: Major
Found in legacy/src/c/owner-message-content.js and 1 other location - About 2 hrs to fix
legacy/src/c/owner-message-content.js on lines 108..114

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

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 applyDocumentMask = (value) => {
            if (value.length > 14) {
                isCnpj(true);
                vm.fields.ownerDocument(documentCompanyMask(value));
            } else {
Severity: Major
Found in legacy/src/root/projects-subscription-checkout.js and 1 other location - About 2 hrs to fix
legacy/src/root/projects-payment.js on lines 74..82

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

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

    oninit: function (vnode) {
        const documentMask = _.partial(h.mask, '999.999.999-99');
        const documentCompanyMask = _.partial(h.mask, '99.999.999/9999-99');

        const cardStatusClassMap = {
Severity: Major
Found in legacy/src/c/user-balance-withdraw-history-item-request.js - About 2 hrs to fix

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

        oninit: function(vnode) {
            const EXPERIMENT_CASE_CURRENT = 'EXPERIMENT_CASE_CURRENT',
                EXPERIMENT_CASE_6SUBHOM = 'EXPERIMENT_CASE_6SUBHOM',
                EXPERIMENT_CASE_3SUBHOM = 'EXPERIMENT_CASE_3SUBHOM';
    
    
    Severity: Major
    Found in legacy/src/c/projects-display.js - About 2 hrs to fix

      Function AjaxRequestStub has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      getJasmineRequireObj().AjaxRequestStub = function() {
        var RETURN = 0,
            ERROR = 1,
            TIMEOUT = 2;
      
      
      Severity: Major
      Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 2 hrs to fix

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

            view: function({state, attrs}) {
                const list = state.listVM,
                    stats = projectVM.isSubscription(attrs.project()) ? attrs.subscriptionData() : state.contributionsStats(),
                    groupedCollection = state.groupedCollection(list.collection());
        
        
        Severity: Minor
        Found in legacy/src/c/project-contributions.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

        Function generateErrorInstance has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        const generateErrorInstance = () => {
            const fields = prop([]);
            const submissionError = prop(false);
            const submissionErrorMsg = prop('');
            const fieldIdxValue = (fieldName, idx, initialValue) => _.reduce(fields(), (memo, field) => field[0] === fieldName ? field[idx] : memo, initialValue);
        Severity: Minor
        Found in legacy/src/error.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

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

            view: function({ state, attrs }) {
                const user = attrs.user,
                    reminders = state.projectReminders(),
                    projects_collection = (state.contributedProjects() || []).concat(
                        state.subscribedProjects() || []
        Severity: Minor
        Found in legacy/src/c/user-notifications.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

        Function AjaxEventBus has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        getJasmineRequireObj().AjaxEventBus = function(eventFactory) {
          function EventBus(source) {
            this.eventList = {};
            this.source = source;
          }
        Severity: Minor
        Found in legacy/spec/lib/jasmine-ajax/mock-ajax.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

        Function renderComponents has 60 lines of code (exceeds 25 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: Major
        Found in legacy/spec/lib/mithril-query/mithril-query.js - About 2 hrs to fix

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

            showSkipped.onchange = function(evt) {
              if (evt.target.checked) {
                self.outerDiv.className += ' show-skipped';
              } else {
                self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
          Severity: Major
          Found in legacy/spec/lib/jasmine-species/jasmine-reporting.js and 1 other location - About 2 hrs to fix
          legacy/spec/lib/jasmine-species/jasmine-reporting.js on lines 83..89

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

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

              view({ attrs }) {
                  return (
                      <div class="section">
                          <div class="w-container">
                              <div class="w-row">
          Severity: Major
          Found in legacy/src/root/projects/publish-by-steps/todo.tsx - About 2 hrs to fix

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

                                                m('.w-row',
                                                    [
                                                        m('.w-sub-col.w-col.w-col-6',
                                                            [
                                                                m('.fontsize-smaller.fontweight-semibold',
            legacy/src/c/project-report-infringes-intellectual-property.js on lines 165..188

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                                                m('.w-row',
                                                    [
                                                        m('.w-sub-col.w-col.w-col-6',
                                                            [
                                                                m('.fontsize-smaller.fontweight-semibold',
            legacy/src/c/project-report-infringes-intellectual-property.js on lines 141..164

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

            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

              showPassed.onchange = function(evt) {
                if (evt.target.checked) {
                  self.outerDiv.className += ' show-passed';
                } else {
                  self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
            Severity: Major
            Found in legacy/spec/lib/jasmine-species/jasmine-reporting.js and 1 other location - About 2 hrs to fix
            legacy/spec/lib/jasmine-species/jasmine-reporting.js on lines 91..97

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

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

                view({ attrs: { goalDetails: goalsDetails, subscriptionData, style }, state } : m.Vnode<ProjectGoalsBoxAttrs, ProjectGoalsBoxState>) {
            
                    const goalsDetailsOrEmpty = () : GoalDetails[] => {
                        const hasGoalsDetails = goalsDetails() && goalsDetails().length > 0
                        if (hasGoalsDetails) {
            Severity: Major
            Found in legacy/src/c/project-goals-box.tsx - About 2 hrs to fix

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

                          } else if (valueFloat < vm.selectedReward().minimum_value + shippingFee.value) {
                              vm.error(`O valor de apoio para essa recompensa deve ser de no mínimo R$${vm.selectedReward().minimum_value} ${projectVM.isSubscription(projectVM.currentProject()) ? '' : `+ frete R$${h.formatNumber(shippingFee.value, 2, 3)}`} `);
                          } else {
                              vm.error('');
                              
              Severity: Major
              Found in legacy/src/c/project-reward-card.js and 1 other location - About 2 hrs to fix
              legacy/src/c/reward-select-card.js on lines 34..45

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

              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

                          } else if (valueFloat < rewardVM.selectedReward().minimum_value + shippingFee.value) {
                              rewardVM.error(`O valor de apoio para essa recompensa deve ser de no mínimo R$${rewardVM.selectedReward().minimum_value} ${projectVM.isSubscription(projectVM.currentProject()) ? '' : `+ frete R$${h.formatNumber(shippingFee.value, 2, 3)}`}`);
                          } else {
                              rewardVM.error('');
                              if (vnode.attrs.isSubscription) {
              Severity: Major
              Found in legacy/src/c/reward-select-card.js and 1 other location - About 2 hrs to fix
              legacy/src/c/project-reward-card.js on lines 48..63

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

              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

              Severity
              Category
              Status
              Source
              Language