catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

Function reportSpecResults has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

jasmine.reporting.StyledHtmlReporter.prototype.reportSpecResults = function(spec) {
  var results = spec.results();
  var status = results.passed() ? 'passed' : 'failed';
  if (results.skipped) {
    status = 'skipped';
Severity: Minor
Found in legacy/spec/lib/jasmine-species/jasmine-reporting.js - About 1 hr to fix

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

        view: function({state, attrs}) {
            const payments = state.payments(),
                transitions = state.transitions(),
                notifications = state.notifications(),
                reward = state.reward(),
    Severity: Minor
    Found in legacy/src/c/admin-subscription-detail.js - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
    Open

        view: function({state, attrs}) {
            const bankAccount = (_.isUndefined(state.metaBank) ? state.userBankAccount() : state.transitionBankAccount());
    
            return m('#admin-balance-transfer-item-detail-box', [
                m('.divider.u-margintop-20.u-marginbottom-20'),
    Severity: Minor
    Found in legacy/src/c/admin-balance-transfer-item-detail.js - About 1 hr 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 safeVal has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    const safeVal = (value, $target, cardNumberProp) => {
        let currPair,
            cursor,
            digit,
            error,
    Severity: Minor
    Found in legacy/src/vms/credit-card-vm.js - About 1 hr 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 createDom has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
      var el = document.createElement(type);
    
      for (var i = 2; i < arguments.length; i++) {
        var child = arguments[i];
    Severity: Minor
    Found in legacy/spec/lib/jasmine/jasmine-html.js - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
    Open

        oninit: function(vnode) {
            const displayForm = h.toggleProp(false, true),
                displayFormWithName = prop(''),
                sendSuccess = prop(false),
                submitDisabled = prop(false),
    Severity: Minor
    Found in legacy/src/c/project-report.js - About 1 hr 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 validateCardExpiry has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    const validateCardExpiry = function (month, year) {
        let currentTime,
            expiry,
            ref;
        if (typeof month === 'object' && 'month' in month) {
    Severity: Minor
    Found in legacy/src/vms/credit-card-vm.js - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
    Open

        oninit: function(vnode) {
            const vm = vnode.attrs.vm,
                isSubscriptionEdit = vnode.attrs.isSubscriptionEdit || prop(false),
                slipPaymentDate = projectVM.isSubscription() ? null : vm.getSlipPaymentDate(vnode.attrs.contribution_id),
                loading = prop(false),
    Severity: Minor
    Found in legacy/src/c/payment-slip.js - About 1 hr 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 reportSpecResults has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
      var results = spec.results();
      var status = results.passed() ? 'passed' : 'failed';
      if (results.skipped) {
        status = 'skipped';
    Severity: Minor
    Found in legacy/spec/lib/jasmine/jasmine-html.js - About 1 hr 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 3 locations. Consider refactoring.
    Open

                                            } else if (contribution.survey_status !== 'not_sent') {
                                                return m('.w-col.w-col-3.w-col-push-1', [
                                                    m('.fontsize-smallest', [
                                                        m('a.link-hidden',
                                                            'Questionário '
    Severity: Major
    Found in legacy/src/c/project-contribution-report-content-card.js and 2 other locations - About 1 hr to fix
    legacy/src/c/project-contribution-report-content-card.js on lines 164..206
    legacy/src/c/project-contribution-report-content-card.js on lines 178..206

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

    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

                                            if (survey.survey_answered_at) {
                                                return m('.w-col.w-col-3.w-col-push-1', [
                                                    m('.fontsize-smallest', [
                                                        m('a.link-hidden',
                                                            'Questionário '
    Severity: Major
    Found in legacy/src/c/project-contribution-report-content-card.js and 2 other locations - About 1 hr to fix
    legacy/src/c/project-contribution-report-content-card.js on lines 178..206
    legacy/src/c/project-contribution-report-content-card.js on lines 192..206

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

    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 trySaveUserAttributesAndValidatePublishProject has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        private async trySaveUserAttributesAndValidatePublishProject(userAttributes : any) {
            const saveRequestConfig = {
                method: 'PUT',
                url: `/users/${this.user_id}.json`,
                data: {
    Severity: Minor
    Found in legacy/src/vms/user-info-edit-vm.ts - About 1 hr 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 3 locations. Consider refactoring.
    Open

                                            } else if (survey.finished_at) {
                                                return m('.w-col.w-col-3.w-col-push-1', [
                                                    m('.fontsize-smallest', [
                                                        m('a.link-hidden',
                                                            'Questionário '
    Severity: Major
    Found in legacy/src/c/project-contribution-report-content-card.js and 2 other locations - About 1 hr to fix
    legacy/src/c/project-contribution-report-content-card.js on lines 164..206
    legacy/src/c/project-contribution-report-content-card.js on lines 192..206

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

    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 createGoal = (projectId, goalData) => m.request({
        method: 'POST',
        url: `/projects/${projectId}/goals.json`,
        data: { goal: goalData },
        config: h.setCsrfToken
    Severity: Major
    Found in legacy/src/vms/project-goals-vm.js and 1 other location - About 1 hr to fix
    legacy/src/vms/reward-vm.js on lines 227..235

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

    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

                generateIdsToData = () => {
                    if (chargebackIds() === undefined) {
                        return null;
                    }
    
    
    Severity: Major
    Found in legacy/src/root/admin-subscriptions.js and 1 other location - About 1 hr to fix
    legacy/src/root/admin-contributions.js on lines 133..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 60.

    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 createReward = (projectId, rewardData) =>
        m.request({
            method: 'POST',
            url: `/projects/${projectId}/rewards.json`,
            data: {
    Severity: Major
    Found in legacy/src/vms/reward-vm.js and 1 other location - About 1 hr to fix
    legacy/src/vms/project-goals-vm.js on lines 62..67

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

    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 RedrawScheduler has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    function RedrawScheduler() {
        let redrawsRequestCounter = 0;
        const markedCallStack = {};
        const requestAnimationFramePolyfill = (function() {
            if (window.requestAnimationFrame !== undefined) {
    Severity: Minor
    Found in legacy/src/h.ts - About 1 hr 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

                generateIdsToData = () => {
                    if (chargebackIds() == undefined) {
                        return null;
                    }
    
    
    Severity: Major
    Found in legacy/src/root/admin-contributions.js and 1 other location - About 1 hr to fix
    legacy/src/root/admin-subscriptions.js on lines 70..76

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

    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('div', [
                                m('span.fontcolor-secondary', window.I18n.t('bank.agency', I18nScope())),
                                m.trust('&nbsp;'),
                                `${item.agency}-${item.agency_digit}`
                            ]),
    Severity: Major
    Found in legacy/src/c/user-balance-request-modal-content.js and 1 other location - About 1 hr to fix
    legacy/src/c/user-balance-request-modal-content.js on lines 183..187

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

    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 projectsExploreVM = new ProjectsExploreViewModel({
                    mode: 'all_modes',
                    category_id: null,
                    searchParam: null,
                    filter: 'all',
    Severity: Major
    Found in legacy/spec/components/vms/projects-explore-vm.spec.js and 1 other location - About 1 hr to fix
    legacy/spec/components/vms/projects-explore-vm.spec.js on lines 184..197

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

    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