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

                                    <form onsubmit={(event : Event) => {
                                        event.preventDefault()
                                        const url = `/${window.I18n.locale}/explore?ref=ctrse_header&utf8=✓&filter=all&pg_search=${searchParam()}`
                                        m.route.set(url)
                                        searchParam('')
Severity: Major
Found in legacy/src/c/explore/explore-mobile-search.tsx and 1 other location - About 2 hrs to fix
legacy/src/c/header-menu-search.ts on lines 35..41

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

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

        const newurl = window.location.protocol + '//' + window.location.host + window.location.pathname + queryString + (window.location.hash === '#' ? '' : window.location.hash);
Severity: Major
Found in legacy/src/h.ts and 5 other locations - About 2 hrs to fix
legacy/src/h.ts on lines 108..108
legacy/src/h.ts on lines 122..122
legacy/src/h.ts on lines 138..138
legacy/src/h.ts on lines 170..170
legacy/src/h.ts on lines 187..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 77.

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

        const newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + queryString + (window.location.hash === '#' ? '' : window.location.hash);
Severity: Major
Found in legacy/src/h.ts and 5 other locations - About 2 hrs to fix
legacy/src/h.ts on lines 108..108
legacy/src/h.ts on lines 122..122
legacy/src/h.ts on lines 154..154
legacy/src/h.ts on lines 170..170
legacy/src/h.ts on lines 187..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 77.

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

        const newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + queryString + (window.location.hash === '#' ? '' : window.location.hash);
Severity: Major
Found in legacy/src/h.ts and 5 other locations - About 2 hrs to fix
legacy/src/h.ts on lines 108..108
legacy/src/h.ts on lines 122..122
legacy/src/h.ts on lines 138..138
legacy/src/h.ts on lines 154..154
legacy/src/h.ts on lines 170..170

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

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

                    onsubmit(event : Event) {
                        event.preventDefault()
                        const url = `/${window.I18n.locale}/explore?ref=ctrse_header&utf8=✓&filter=all&pg_search=${searchParam()}`
                        m.route.set(url)
                        searchParam('')
Severity: Major
Found in legacy/src/c/header-menu-search.ts and 1 other location - About 2 hrs to fix
legacy/src/c/explore/explore-mobile-search.tsx on lines 35..41

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

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

        const newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + queryString + (window.location.hash === '#' ? '' : window.location.hash);
Severity: Major
Found in legacy/src/h.ts and 5 other locations - About 2 hrs to fix
legacy/src/h.ts on lines 108..108
legacy/src/h.ts on lines 138..138
legacy/src/h.ts on lines 154..154
legacy/src/h.ts on lines 170..170
legacy/src/h.ts on lines 187..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 77.

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

    oninit: function(vnode) {
        const vm = projectGoalVM,
            mapErrors = [
                  ['mode', ['mode']],
                  ['goal', ['goal']],
Severity: Minor
Found in legacy/src/c/project-goal-edit.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 16 (exceeds 5 allowed). Consider refactoring.
Open

    oninit: function(vnode) {
        const vm = projectDescriptionVideoVM,
            mapErrors = [
                  ['about_html', ['about_html']],
                  ['video_url', ['video_url']]
Severity: Minor
Found in legacy/src/c/project-description-video-edit.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 16 (exceeds 5 allowed). Consider refactoring.
Open

    oninit: function(vnode) {
        const vm = projectVideoVM,
            mapErrors = [
                  ['video_url', ['video_url']]
            ],
Severity: Minor
Found in legacy/src/c/project-video-edit.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 16 (exceeds 5 allowed). Consider refactoring.
Open

    oninit: function(vnode) {
        const vm = projectDescriptionVM,
            mapErrors = [
                  ['about_html', ['about_html']]
            ],
Severity: Minor
Found in legacy/src/c/project-description-edit.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 16 (exceeds 5 allowed). Consider refactoring.
Open

    view: function({attrs})
    {
        const 
            disableFields = attrs.disableFields,
            fields = attrs.fields(),
Severity: Minor
Found in legacy/src/c/user-settings-responsible.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 16 (exceeds 5 allowed). Consider refactoring.
Open

    oninit: function(vnode) {
        const vm = projectBudgetVM,
            mapErrors = [
                  ['budget', ['budget']]
            ],
Severity: Minor
Found in legacy/src/c/project-budget-edit.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 chargebackConfirmationModalContentWrapper has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            chargebackConfirmationModalContentWrapper = (customAttrs) => {
                const wrapper = {
                    view: function({state, attrs}) {
                        return m('', [
                            m('.modal-dialog-header', [
Severity: Major
Found in legacy/src/root/admin-contributions.js - About 2 hrs to fix

    Function chargebackConfirmationModalContentWrapper has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                chargebackConfirmationModalContentWrapper = (customAttrs) => {
                    const wrapper = {
                        view({state, attrs}) {
                            return m('', [
                                m('.modal-dialog-header', [
    Severity: Major
    Found in legacy/src/root/admin-subscriptions.js - About 2 hrs to fix

      Function trySaveUserAttributesAndValidatePublishProject has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private async trySaveUserAttributesAndValidatePublishProject(userAttributes : any) {
              const saveRequestConfig = {
                  method: 'PUT',
                  url: `/users/${this.user_id}.json`,
                  data: {
      Severity: Major
      Found in legacy/src/vms/user-info-edit-vm.ts - About 2 hrs to fix

        Function strftime has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          I18n.strftime = function(date, format) {
            var options = this.lookup("date")
              , meridianOptions = I18n.meridian()
            ;
        
        
        Severity: Major
        Found in legacy/spec/lib/i18n/i18n.js - About 2 hrs to fix

          Function validateCnpj has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              validateCnpj = cnpjStr => {
                  let tamanho, numeros, digitos, soma, pos, resultado;
                  const cnpj = cnpjStr.replace(/[^\d]+/g, '');
          
                  if (cnpj == '') {
          Severity: Major
          Found in legacy/src/h.ts - About 2 hrs to fix

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

                getRdToken = () => {
                    if (_dataCache.rdToken) {
                        return _dataCache.rdToken;
                    }
            
            
            Severity: Major
            Found in legacy/src/h.ts and 2 other locations - About 2 hrs to fix
            legacy/src/h.ts on lines 477..484
            legacy/src/h.ts on lines 985..993

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

            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

                getNewsletterUrl = () => {
                    if (_dataCache.newsletterUrl) {
                        return _dataCache.newsletterUrl;
                    }
            
            
            Severity: Major
            Found in legacy/src/h.ts and 2 other locations - About 2 hrs to fix
            legacy/src/h.ts on lines 469..476
            legacy/src/h.ts on lines 985..993

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

            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

                rootUrl = () => {
                    if (_dataCache.rootUrl) {
                        return _dataCache.rootUrl;
                    }
            
            
            Severity: Major
            Found in legacy/src/h.ts and 2 other locations - About 2 hrs to fix
            legacy/src/h.ts on lines 469..476
            legacy/src/h.ts on lines 477..484

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

            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