catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

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

    view({state}) {
        const project = _.first(state.projectDetails());
        const reward = _.first(state.reward());
        return [
            project ? 
Severity: Minor
Found in legacy/src/root/survey-create.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 oninit has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    oninit: function(vnode) {
        const goal = vnode.attrs.goal(),
            project = vnode.attrs.project,
            descriptionError = prop(false),
            titleError = prop(false),
Severity: Minor
Found in legacy/src/c/project-goal-edit-card.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 17 (exceeds 5 allowed). Consider refactoring.
Open

    view: function ({ state, attrs }) {
        const balance = attrs.balance;
        const fields = state.fields;
        const bankCode = state.bankCode;
        const user = attrs.user;
Severity: Minor
Found in legacy/src/c/user-balance-request-modal-content.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 oninit has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    oninit: function(vnode) {
        const builder = vnode.attrs.data,
            complete = prop(false),
            data = {},
            error = prop(false),
Severity: Minor
Found in legacy/src/c/admin-radio-action.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

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

                                                m('input.password.optional.w-input.text-field.w-input.text-field.positive[id=\'user_password\'][name=\'user[password]\'][type=\'password\']', {
                                                    class: state.passwordHasError() ? 'error' : '',
                                                    value: fields.password(),
                                                    onfocus: () => state.passwordHasError(false),
                                                    onblur: state.validatePassword,
Severity: Major
Found in legacy/src/c/user-about-edit.js and 1 other location - About 2 hrs to fix
legacy/src/c/user-about-edit.js on lines 301..307

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

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('input.string.required.w-input.text-field.w-input.text-field.positive[id=\'new_email_confirmation\'][name=\'user[email]\'][type=\'text\']', {
                                                class: state.emailHasError() ? 'error' : '',
                                                value: fields.email_confirmation(),
                                                onfocus: () => state.emailHasError(false),
                                                onblur: state.validateEmailConfirmation,
Severity: Major
Found in legacy/src/c/user-about-edit.js and 1 other location - About 2 hrs to fix
legacy/src/c/user-about-edit.js on lines 499..505

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

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(projectMain, {
                style: blurredScreenConditionalStyle,
                project,
                post_id: attrs.post_id,
                hasSubscription: state.hasSubscription,
Severity: Major
Found in legacy/src/root/projects-show.js and 1 other location - About 2 hrs to fix
legacy/src/root/projects-show.js on lines 126..136

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

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(projectHeader, {
                style: blurredScreenConditionalStyle,
                project,
                hasSubscription: state.hasSubscription,
                userProjectSubscriptions: state.userProjectSubscriptions,
Severity: Major
Found in legacy/src/root/projects-show.js and 1 other location - About 2 hrs to fix
legacy/src/root/projects-show.js on lines 144..154

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

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

    oninit: function(vnode) {
        const parsedErrors = vnode.attrs.parsedErrors;
        const statesLoader = catarse.loader(models.state.getPageOptions()),
            defaultCountryID = addressVM.defaultCountryID,
            defaultForeignCountryID = addressVM.defaultForeignCountryID,
Severity: Major
Found in legacy/src/c/address-form.js - About 2 hrs to fix

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

        oninit: function(vnode) {
            const templates = commonNotification.paginationVM(
                models.notificationTemplates, 'label.asc'),
                loaderTemp = prop(true),
                loaderSubmit = prop(false),
    Severity: Major
    Found in legacy/src/root/admin-notifications.js - About 2 hrs to fix

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

          oninit: function(vnode) {
              const showSelectedMenu = h.toggleProp(false, true),
                  selectedAny = prop(false),
                  showSuccess = prop(false),
                  loading = prop(false),
      Severity: Major
      Found in legacy/src/c/project-contribution-report-content.js - About 2 hrs to fix

        Function sendSlipPayment has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const sendSlipPayment = (fields, commonData) => {
            fields.isLoading(true);
            m.redraw();
        
            const customer = fields.fields;
        Severity: Major
        Found in legacy/src/vms/common-payment-vm.js - About 2 hrs to fix

          Function locationOptions has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const locationOptions = (reward, destination) => {
              const options = prop([]),
                  mapStates = _.map(states(), state => {
                      let fee;
                      const feeState = _.findWhere(fees(), {
          Severity: Major
          Found in legacy/src/vms/reward-vm.js - About 2 hrs to fix

            Function reportRunnerStarting has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            jasmine.reporting.StyledHtmlReporter.prototype.reportRunnerStarting = function(runner) {
              var showPassed, showSkipped;
            
              this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' },
                  this.createDom('div', { className: 'banner' },
            Severity: Major
            Found in legacy/spec/lib/jasmine-species/jasmine-reporting.js - About 2 hrs to fix

              Function generateErrorInstance has 55 lines of code (exceeds 25 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: Major
              Found in legacy/src/error.js - About 2 hrs to fix

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

                        oninit: function (vnode) {
                
                            try {
                                if (firstRun) {
                                    firstRun = false;
                Severity: Major
                Found in legacy/src/wrap.js - About 2 hrs to fix

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

                      oninit: function(vnode) {
                          const checkedList = prop([]),
                              loading = prop(false),
                              filterTerm = prop(''),
                              filteredData = prop(vnode.attrs.dataEmails()),
                  Severity: Major
                  Found in legacy/src/c/invite-emails-from-import.js - About 2 hrs to fix

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

                                                    m(inputCard, {
                                                        label: window.I18n.t('service_fee', I18nScope()),
                                                        children: [
                                                            m('input.string.optional.w-input.text-field.positive.medium[type="number"]', {
                                                                value: vm.fields.service_fee(),
                    Severity: Major
                    Found in legacy/src/c/project-basics-edit.js and 2 other locations - About 2 hrs to fix
                    legacy/src/c/project-basics-edit.js on lines 181..189
                    legacy/src/c/project-basics-edit.js on lines 190..198

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

                    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(inputCard, {
                                                        label: window.I18n.t('tracker_snippet_html', I18nScope()),
                                                        children: [
                                                            m('textarea.text.optional.w-input.text-field.positive.medium', {
                                                                value: vm.fields.tracker_snippet_html(),
                    Severity: Major
                    Found in legacy/src/c/project-basics-edit.js and 2 other locations - About 2 hrs to fix
                    legacy/src/c/project-basics-edit.js on lines 190..198
                    legacy/src/c/project-basics-edit.js on lines 209..217

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

                    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

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

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

                    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