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

                            m(bigInputCard, {
                                label: window.I18n.t('description_label', I18nScope()),
                                label_hint: window.I18n.t('description_hint', I18nScope()),
                                children: [
                                    m('.preview-container', {
Severity: Major
Found in legacy/src/c/project-description-edit.js and 1 other location - About 4 hrs to fix
legacy/src/c/project-description-video-edit.js on lines 96..105

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

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

  var specDiv = this.createDom('div', { className: 'spec '  + status },
      this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
      this.createDom('a', {
        className: 'description',
        href: '?spec=' + encodeURIComponent(spec.getFullName()),
Severity: Major
Found in legacy/spec/lib/jasmine-species/jasmine-reporting.js and 1 other location - About 4 hrs to fix
legacy/spec/lib/jasmine/jasmine-html.js on lines 131..137

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

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

                            m(bigInputCard, {
                                label: window.I18n.t('description_label', I18nScope()),
                                label_hint: window.I18n.t('description_hint', I18nScope()),
                                children: [
                                    m('.preview-container', {
Severity: Major
Found in legacy/src/c/project-description-video-edit.js and 1 other location - About 4 hrs to fix
legacy/src/c/project-description-edit.js on lines 77..86

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

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

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

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

        oninit: function(vnode) {
            const filtersVM = vnode.attrs.filtersVM,
                displayModal = h.toggleProp(false, true),
                contributionsPerDay = prop([]),
                visitorsTotal = prop(0),
    Severity: Major
    Found in legacy/src/c/project-insights.js - About 4 hrs to fix

      Function renderBody has 99 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private renderBody({ projectPublishByStepsVM, userInfoEditVM, showPopError } : ProjectsPublishByStepsState) {
      
              if (projectPublishByStepsVM.isLoadingProject || userInfoEditVM.isLoading) {
                  return h.loader()
              } else {

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

                                    m('.table-col.w-hidden-small.w-hidden-tiny.w-col.w-col-2.w-col-small-2.w-col-stack.w-col-tiny-2', [
                                        m('.fontweight-semibold', `R$${h.formatNumber((slip.new_amount + credit_card.new_amount) / 100, 2, 3)}`),
                                        m('.fontsize-smallest.fontcolor-secondary', `R$${h.formatNumber((credit_card.new_amount) / 100, 2, 3)}`),
                                        m('.fontsize-smallest.fontcolor-secondary', `R$${h.formatNumber((slip.new_amount) / 100, 2, 3)}`)
                                    ]),
        Severity: Major
        Found in legacy/src/c/subscriptions-per-month-table.js and 1 other location - About 3 hrs to fix
        legacy/src/c/subscriptions-per-month-table.js on lines 69..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 114.

        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-2.w-col-small-2.w-col-stack.w-col-tiny-2', [
                                        m('.fontweight-semibold.text-success', `R$${h.formatNumber(((slip.total_amount) + (credit_card.total_amount)) / 100, 2, 3)}`),
                                        m('.fontsize-smallest.fontcolor-secondary', `R$${h.formatNumber((credit_card.total_amount) / 100, 2, 3)}`),
                                        m('.fontsize-smallest.fontcolor-secondary', `R$${h.formatNumber((slip.total_amount) / 100, 2, 3)}`)
                                    ])
        Severity: Major
        Found in legacy/src/c/subscriptions-per-month-table.js and 1 other location - About 3 hrs to fix
        legacy/src/c/subscriptions-per-month-table.js on lines 59..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 114.

        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 27 (exceeds 5 allowed). Consider refactoring.
        Open

            oninit: function(vnode) {
                const filtersVM = vnode.attrs.filtersVM,
                    displayModal = h.toggleProp(false, true),
                    contributionsPerDay = prop([]),
                    visitorsTotal = prop(0),
        Severity: Minor
        Found in legacy/src/c/project-insights.js - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

            summary: function() {
                var suite = jasmine.grammar.getEnv().currentSuite;
                suite.summary = suite.summary || [];
                
                if (arguments.length > 0) {
        Severity: Major
        Found in legacy/spec/lib/jasmine-species/jasmine-grammar.js and 1 other location - About 3 hrs to fix
        legacy/spec/lib/jasmine-species/jasmine-grammar.js on lines 212..221

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

        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

            details: function() {
                var spec = jasmine.grammar.getEnv().currentSpec;
                spec.details = spec.details || [];
                
                if (arguments.length > 0) {
        Severity: Major
        Found in legacy/spec/lib/jasmine-species/jasmine-grammar.js and 1 other location - About 3 hrs to fix
        legacy/spec/lib/jasmine-species/jasmine-grammar.js on lines 195..204

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

        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

                              !_.isEmpty(projects_collection)
                                  ? _.map(projects_collection, project =>
                                        m(projectCard, {
                                            project,
                                            ref: 'user_contributed',
        Severity: Major
        Found in legacy/src/c/user-created.js and 1 other location - About 3 hrs to fix
        legacy/src/c/user-contributed.js on lines 63..85

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

        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

                          !_.isEmpty(projects_collection)
                              ? _.map(projects_collection, project =>
                                    m(projectCard, {
                                        project,
                                        ref: 'user_contributed',
        Severity: Major
        Found in legacy/src/c/user-contributed.js and 1 other location - About 3 hrs to fix
        legacy/src/c/user-created.js on lines 56..78

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

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

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

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

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

        Refactorings

        Further Reading

        File project-contribution-report-content-card.js has 329 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import m from 'mithril';
        import prop from 'mithril/stream';
        import _ from 'underscore';
        import moment from 'moment';
        import { catarse } from '../api';
        Severity: Minor
        Found in legacy/src/c/project-contribution-report-content-card.js - About 3 hrs to fix

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

                                                          m('li.fontsize-smaller.u-marginbottom-10',
                                                              m('div', [
                                                                  'Apoios cancelados após o pagamento',
                                                                  m.trust(' '),
                                                                  m.trust(' '),
          Severity: Major
          Found in legacy/src/c/download-reports.js and 1 other location - About 3 hrs to fix
          legacy/src/c/download-reports.js on lines 77..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 112.

          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('li.fontsize-smaller.u-marginbottom-10',
                                                                          m('div', [
                                                                              'Apoiadores pendentes',
                                                                              m.trust(' '),
                                                                              m.trust(' '),
          Severity: Major
          Found in legacy/src/c/download-reports.js and 1 other location - About 3 hrs to fix
          legacy/src/c/download-reports.js on lines 113..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 112.

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

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

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

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

          Refactorings

          Further Reading

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

                  const selectDestination = (destination) => {
                      selectedDestination(destination);
          
                      const shippingFee = vm.shippingFeeForCurrentReward(selectedDestination)
                          ? Number(vm.shippingFeeForCurrentReward(selectedDestination).value)
          Severity: Major
          Found in legacy/src/c/project-reward-card.js and 1 other location - About 3 hrs to fix
          legacy/src/c/reward-select-card.js on lines 52..59

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

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

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

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

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

          Refactorings

          Further Reading

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

                  const selectDestination = (destination) => {
                      selectedDestination(destination);
                      const shippingFee = rewardVM.shippingFeeForCurrentReward(selectedDestination) ?
                          Number(rewardVM.shippingFeeForCurrentReward(selectedDestination).value) :
                          0;
          Severity: Major
          Found in legacy/src/c/reward-select-card.js and 1 other location - About 3 hrs to fix
          legacy/src/c/project-reward-card.js on lines 30..38

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

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

                  const displayTabContent = () => {
          
                      hash(window.location.hash);
                      const isUnpublishedAdmin = !project().is_published || project().is_admin_role;
                      const isEmptyHash = _.isEmpty(hash()) || hash() === '#_=_';
          Severity: Major
          Found in legacy/src/root/project-edit.js - About 3 hrs to fix

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

                oninit: function(vnode) {
                    let bankl;
                    const currentItem = prop(vnode.attrs.item);
                    const project_id = vnode.attrs.item.project_id;
                    const loadBank = () => {
            Severity: Major
            Found in legacy/src/c/admin-project-detail.js - About 3 hrs to fix
              Severity
              Category
              Status
              Source
              Language