catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

Function oninit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    oninit: function(vnode) {
        let parentHeight = prop(0),
            width = prop(vnode.attrs.width || 280),
            top = prop(0),
            left = prop(0),
Severity: Minor
Found in legacy/src/c/tooltip.js - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    view: function({state, attrs}) {
        const data = attrs.data,
            btnValue = (state.l()) ? 'por favor, aguarde...' : data.callToAction;

        return m('.w-col.w-col-2', [
Severity: Minor
Found in legacy/src/c/admin-reset-password.js - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    view: function ({ attrs }) {
        const collection = attrs.collection,
            title = attrs.title || collection.title,
            ref = attrs.ref,
            showFriends = attrs.showFriends,
Severity: Minor
Found in legacy/src/c/project-row-with-header.js - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    view: function({ state, attrs }) {
        const subsCollection = state.subscriptions.collection(),
            onlineCollection = state.onlinePages.collection(),
            successfulCollection = state.successfulPages.collection(),
            failedCollection = state.failedPages.collection();
Severity: Minor
Found in legacy/src/c/user-private-contributed.js - About 35 mins 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 getContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function getContent(thing) {
  if (!thing) {
    return ''
  }
  if (isString(thing)) {
Severity: Minor
Found in legacy/spec/lib/mithril-query/mithril-query.js - About 35 mins 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 getPaymentInfoUntilNoError has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const getPaymentInfoUntilNoError = (paymentMethod, isEdit) => ({ id, catalog_payment_id }) => {
    const p = new Promise((resolve, reject) => {
        const paymentId = isEdit ? catalog_payment_id : id;

        if (paymentId) {
Severity: Minor
Found in legacy/src/vms/common-payment-vm.js - About 35 mins 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 locationOptions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const locationOptions = (reward, destination) => {
    const options = prop([]),
        mapStates = _.map(states(), state => {
            let fee;
            const feeState = _.findWhere(fees(), {
Severity: Minor
Found in legacy/src/vms/reward-vm.js - About 35 mins 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 formatException has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

jasmine.util.formatException = function(e) {
  var lineNumber;
  if (e.line) {
    lineNumber = e.line;
  }
Severity: Minor
Found in legacy/spec/lib/jasmine/jasmine.js - About 35 mins 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 summarizeResult_ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
  var summaryMessages = [];
  var messagesLength = result.messages.length;
  for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) {
    var resultMessage = result.messages[messageIndex];
Severity: Minor
Found in legacy/spec/lib/jasmine/jasmine.js - About 35 mins 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 getUserRecommendedProjects has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const getUserRecommendedProjects = contribution => {
    const sample3 = _.partial(_.sample, _, 3),
        loaders = prop([]),
        collection = prop([]),
        { user_id } = h.getUser();
Severity: Minor
Found in legacy/src/vms/user-vm.js - About 35 mins 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 analyticsWindowScroll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    analyticsWindowScroll = eventObj => {
        if (eventObj) {
            setTimeout(() => {
                const u = window.location.href;
                let fired = false;
Severity: Minor
Found in legacy/src/h.ts - About 35 mins 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 validateCpf has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    validateCpf = strCPF => {
        let sum = 0,
            remainder;

        if (strCPF == '00000000000') return false;
Severity: Minor
Found in legacy/src/h.ts - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    view({ attrs, state } : m.Vnode<ShareAttrs, ShareState>) {
        
        const project = attrs.project
        const projectUrl = `${window.location.origin}/${project.permalink}`
        const copyToClipboard = (copyText : HTMLInputElement) => {
Severity: Minor
Found in legacy/src/root/projects/publish-by-steps/share.tsx - About 35 mins 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 AjaxStubTracker has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

getJasmineRequireObj().AjaxStubTracker = function() {
  function StubTracker() {
    var stubs = [];

    this.addStub = function(stub) {
Severity: Minor
Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 35 mins 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 analyticsEvent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    analyticsEvent = (eventObj, fn = Function.prototype) => {
        // https://developers.google.com/analytics/devguides/collection/analyticsjs/command-queue-reference#send
        if (!eventObj) {
            return fn;
        }
Severity: Minor
Found in legacy/src/h.ts - About 35 mins 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 8 locations. Consider refactoring.
Open

                (state.showSuccess() ? m(popNotification, {
                    message: window.I18n.t('shared.successful_update'),
                    toggleOpt: state.showSuccess
                }) : ''),
Severity: Major
Found in legacy/src/root/project-edit-integrations.js and 7 other locations - About 35 mins to fix
legacy/src/c/project-basics-edit.js on lines 161..166
legacy/src/c/project-budget-edit.js on lines 58..61
legacy/src/c/project-card-edit.js on lines 72..75
legacy/src/c/project-description-edit.js on lines 58..61
legacy/src/c/project-description-video-edit.js on lines 61..64
legacy/src/c/project-goal-edit.js on lines 69..72
legacy/src/c/project-video-edit.js on lines 58..61

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

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

            { // progress
                component: filterNumberRange,
                data: {
                    label: 'Progresso % entre',
                    first: filterVM.progress.gte,
Severity: Major
Found in legacy/src/root/admin-projects.js and 6 other locations - About 35 mins to fix
legacy/src/root/admin-contributions.js on lines 108..115
legacy/src/root/admin-contributions.js on lines 115..122
legacy/src/root/admin-projects.js on lines 100..107
legacy/src/root/admin-projects.js on lines 116..123
legacy/src/root/admin-projects.js on lines 124..131
legacy/src/root/admin-projects.js on lines 132..139

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

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

            }, { // created_at
                component: filterDateRange,
                data: {
                    label: 'Período do apoio',
                    first: filterVM.created_at.gte,
Severity: Major
Found in legacy/src/root/admin-contributions.js and 6 other locations - About 35 mins to fix
legacy/src/root/admin-contributions.js on lines 108..115
legacy/src/root/admin-projects.js on lines 100..107
legacy/src/root/admin-projects.js on lines 108..115
legacy/src/root/admin-projects.js on lines 116..123
legacy/src/root/admin-projects.js on lines 124..131
legacy/src/root/admin-projects.js on lines 132..139

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

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

            (state.showSuccess() ? m(popNotification, {
                message: window.I18n.t('shared.successful_update'),
                toggleOpt: state.showSuccess
            }) : ''),
Severity: Major
Found in legacy/src/c/project-description-edit.js and 7 other locations - About 35 mins to fix
legacy/src/c/project-basics-edit.js on lines 161..166
legacy/src/c/project-budget-edit.js on lines 58..61
legacy/src/c/project-card-edit.js on lines 72..75
legacy/src/c/project-description-video-edit.js on lines 61..64
legacy/src/c/project-goal-edit.js on lines 69..72
legacy/src/c/project-video-edit.js on lines 58..61
legacy/src/root/project-edit-integrations.js on lines 111..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 46.

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

            }, { // goal
                component: filterNumberRange,
                data: {
                    label: 'Meta entre',
                    first: filterVM.goal.gte,
Severity: Major
Found in legacy/src/root/admin-projects.js and 6 other locations - About 35 mins to fix
legacy/src/root/admin-contributions.js on lines 108..115
legacy/src/root/admin-contributions.js on lines 115..122
legacy/src/root/admin-projects.js on lines 108..115
legacy/src/root/admin-projects.js on lines 116..123
legacy/src/root/admin-projects.js on lines 124..131
legacy/src/root/admin-projects.js on lines 132..139

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

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