catarse/catarse.js

View on GitHub
legacy/src/h.ts

Summary

Maintainability
F
1 wk
Test Coverage

File h.ts has 1299 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import _ from 'underscore';
import moment from 'moment';
import * as Sentry from '@sentry/browser';
import m from 'mithril';
import prop from 'mithril/stream';
Severity: Major
Found in legacy/src/h.ts - About 3 days 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

      Consider simplifying this complex logical expression.
      Open

              if (
                  cnpj == '00000000000000' ||
                  cnpj == '11111111111111' ||
                  cnpj == '22222222222222' ||
                  cnpj == '33333333333333' ||
      Severity: Critical
      Found in legacy/src/h.ts - About 2 hrs to fix

        Function createBasicPaginationVMWithAutoRedraw has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            createBasicPaginationVMWithAutoRedraw = vmInstance => {
                const error = prop(false);
                const errorMessage = prop('');
        
                return {
        Severity: Minor
        Found in legacy/src/h.ts - About 1 hr to fix

          Function projectStateTextClass has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              projectStateTextClass = (state, has_cancelation_request) => {
                  const statusText = {
                      online: {
                          cssClass: 'text-success',
                          text: 'NO AR',
          Severity: Minor
          Found in legacy/src/h.ts - About 1 hr to fix

            Function validateCnpj has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                validateCnpj = cnpjStr => {
                    let tamanho, numeros, digitos, soma, pos, resultado;
                    const cnpj = cnpjStr.replace(/[^\d]+/g, '');
            
                    if (cnpj == '') {
            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

            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

            Function RedrawScheduler has 31 lines of code (exceeds 25 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

              Function validate has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  validate = () => {
                      const errorFields = prop([]);
              
                      return {
                          submit(fields, fn) {
              Severity: Minor
              Found in legacy/src/h.ts - About 1 hr to fix

                Function closeModal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    closeModal = () => {
                        // Temp for rails unstyled close links
                        const close = (elm, selector) => {
                            const all = document.getElementsByClassName(selector);
                            let cur = elm.parentNode;
                Severity: Minor
                Found in legacy/src/h.ts - About 1 hr to fix

                  Function isCharAllowed has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      isCharAllowed = maskCharDefinitions => maskDefinition => (position, newChar) => {
                          if (position >= maskDefinition.length) {
                              return false;
                          }
                  
                  
                  Severity: Minor
                  Found in legacy/src/h.ts - About 45 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 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

                  Avoid too many return statements within this function.
                  Open

                              return false;
                  Severity: Major
                  Found in legacy/src/h.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return true;
                    Severity: Major
                    Found in legacy/src/h.ts - About 30 mins to fix

                      Function generateFormatNumber has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          generateFormatNumber = (s, c) => (number, n, x) => {
                              if (!_.isNumber(number)) {
                                  return null;
                              }
                      
                      
                      Severity: Minor
                      Found in legacy/src/h.ts - About 25 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 closeModal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          closeModal = () => {
                              // Temp for rails unstyled close links
                              const close = (elm, selector) => {
                                  const all = document.getElementsByClassName(selector);
                                  let cur = elm.parentNode;
                      Severity: Minor
                      Found in legacy/src/h.ts - About 25 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 createBasicPaginationVMWithAutoRedraw has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          createBasicPaginationVMWithAutoRedraw = vmInstance => {
                              const error = prop(false);
                              const errorMessage = prop('');
                      
                              return {
                      Severity: Minor
                      Found in legacy/src/h.ts - About 25 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 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

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

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

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

                              const keysAndValues = reduceSearchString((finalQueryObject, keyValue) => {
                                  const [key, value] = keyValue.split('=');
                                  if (!resetParams.includes(key) && key) {
                                      finalQueryObject[key] = value;
                                  }
                      Severity: Major
                      Found in legacy/src/h.ts and 1 other location - About 1 hr to fix
                      legacy/src/h.ts on lines 176..183

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

                      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 keysAndValues = reduceSearchString((finalQueryObject, keyValue) => {
                      
                                  const [key, value] = keyValue.split('=');            
                                  if (!paramsNamesToRemove.includes(key) && key) {
                                      finalQueryObject[key] = value;
                      Severity: Major
                      Found in legacy/src/h.ts and 1 other location - About 1 hr to fix
                      legacy/src/h.ts on lines 128..134

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

                      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

                              for (let i = tamanho; i >= 1; i--) {
                                  soma += Number(numeros.charAt(tamanho - i)) * pos--;
                                  if (pos < 2) {
                                      pos = 9;
                                  }
                      Severity: Major
                      Found in legacy/src/h.ts and 1 other location - About 1 hr to fix
                      legacy/src/h.ts on lines 319..324

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

                      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

                              for (let i = tamanho; i >= 1; i--) {
                                  soma += Number(numeros.charAt(tamanho - i)) * pos--;
                                  if (pos < 2) {
                                      pos = 9;
                                  }
                      Severity: Major
                      Found in legacy/src/h.ts and 1 other location - About 1 hr to fix
                      legacy/src/h.ts on lines 304..309

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

                      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

                              const keysAndValues = reduceSearchString((finalQueryObject, keyValue) => {
                                  const [key, value] = keyValue.split('=');
                                  if (key) {
                                      finalQueryObject[key] = value;
                                  }
                      Severity: Major
                      Found in legacy/src/h.ts and 1 other location - About 1 hr to fix
                      legacy/src/h.ts on lines 96..102

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

                      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

                              const keysAndValues = reduceSearchString((finalQueryObject, keyValue) => {
                                  const [key, value] = keyValue.split('=');
                                  if (key) {
                                      finalQueryObject[key] = value;
                                  }
                      Severity: Major
                      Found in legacy/src/h.ts and 1 other location - About 1 hr to fix
                      legacy/src/h.ts on lines 112..118

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

                      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

                              for (let i = 1; i <= 10; i++) {
                                  sum += parseInt(strCPF.substring(i - 1, i)) * (12 - i);
                              }
                      Severity: Major
                      Found in legacy/src/h.ts and 1 other location - About 1 hr to fix
                      legacy/src/h.ts on lines 338..340

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

                      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

                              for (let i = 1; i <= 9; i++) {
                                  sum += parseInt(strCPF.substring(i - 1, i)) * (11 - i);
                              }
                      Severity: Major
                      Found in legacy/src/h.ts and 1 other location - About 1 hr to fix
                      legacy/src/h.ts on lines 353..355

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

                      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

                          authenticityToken = () => {
                              const meta = _.first(document.querySelectorAll('[name=csrf-token]'));
                              return meta ? meta.getAttribute('content') : null;
                          },
                      Severity: Minor
                      Found in legacy/src/h.ts and 1 other location - About 45 mins to fix
                      legacy/src/h.ts on lines 679..682

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

                      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

                          authenticityParam = () => {
                              const meta = _.first(document.querySelectorAll('[name=csrf-param]'));
                              return meta ? meta.getAttribute('content') : null;
                          },
                      Severity: Minor
                      Found in legacy/src/h.ts and 1 other location - About 45 mins to fix
                      legacy/src/h.ts on lines 675..678

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

                      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

                              if (_.isElement(elById)) {
                                  elById.onclick = event => {
                                      event.preventDefault();
                                      close(elById, 'modal-backdrop');
                                  };
                      Severity: Minor
                      Found in legacy/src/h.ts and 1 other location - About 45 mins to fix
                      legacy/src/h.ts on lines 636..641

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

                      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

                                  if (_.isElement(el)) {
                                      el.onclick = event => {
                                          event.preventDefault();
                                          close(el, 'modal-backdrop');
                                      };
                      Severity: Minor
                      Found in legacy/src/h.ts and 1 other location - About 45 mins to fix
                      legacy/src/h.ts on lines 627..632

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

                      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 extractPhoneNumber = (phoneNumberStr) => {
                          const extractPhoneFieldsRegex = /\(([^)]*)\)(.*)/;
                          return phoneNumberStr.match(extractPhoneFieldsRegex)[2].replace(/\D/g, '');
                      };
                      Severity: Minor
                      Found in legacy/src/h.ts and 1 other location - About 40 mins to fix
                      legacy/src/h.ts on lines 1238..1241

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

                      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 extractPhoneDDD = (phoneNumberStr) => {
                          const extractPhoneFieldsRegex = /\(([^)]*)\)(.*)/;
                          return phoneNumberStr.match(extractPhoneFieldsRegex)[1].replace(/\D/g, '');
                      };
                      Severity: Minor
                      Found in legacy/src/h.ts and 1 other location - About 40 mins to fix
                      legacy/src/h.ts on lines 1247..1250

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

                      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

                          captureMessage = (message) => {
                              try {
                                  Sentry.captureMessage(message);
                              } catch (e) {
                                  Sentry.captureException(e);
                      Severity: Minor
                      Found in legacy/src/h.ts and 1 other location - About 35 mins to fix
                      legacy/src/h.ts on lines 1190..1196

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

                          captureException = (exception) => {
                              try {
                                  Sentry.captureException(exception);
                              } catch (e) {
                                  Sentry.captureException(e);
                      Severity: Minor
                      Found in legacy/src/h.ts and 1 other location - About 35 mins to fix
                      legacy/src/h.ts on lines 1197..1203

                      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

                      There are no issues that match your filters.

                      Category
                      Status