silegis-mg/editor-articulacao

View on GitHub

Showing 86 of 86 total issues

Function _normalizarParagrafo has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _normalizarParagrafo(dispositivo) {
        let anterior = encontrarDispositivoAnteriorDoTipo(dispositivo, ['artigo', 'paragrafo']);
        let posterior = encontrarDispositivoPosteriorDoTipo(dispositivo, ['artigo', 'paragrafo']);

        if (dispositivo.getAttribute('data-tipo') === 'paragrafo' || dispositivo.getAttribute('data-tipo') === 'continuacao') {
Severity: Minor
Found in src/EditorArticulacaoController.js - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

        if (!keyboardEvent.ctrlKey && !keyboardEvent.altKey && !keyboardEvent.metaKey &&
            keyboardEvent.key.length === 1 || keyboardEvent.key === 'Delete' || keyboardEvent.key === 'Backspace' ||
            keyboardEvent.key === 'Enter') {
    
            let selection = editorCtrl.getSelection();
    Severity: Major
    Found in src/hacks/chrome.js - About 1 hr to fix

      Function transformar has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          transformar(elementoEditor, ctrl, contexto, sequencia, event) {
              if (contexto.cursor.dispositivo.textContent.trim().length === 0) {
                  let novoTipo = {
                      item: 'alinea',
                      alinea: 'inciso',

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

      function hackAlterarTipo(ctrl, metodo, argumentos) {
          let dispositivo = ctrl.contexto.cursor.dispositivo;
          let contadoresAntigos = extrairContadores(dispositivo);
          let retorno  = metodo.apply(ctrl, argumentos);
          let contadoresNovos = extrairContadores(dispositivo, contadoresAntigos.hash);
      Severity: Minor
      Found in src/hacks/chrome.js - About 55 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

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

                  this.cntSubitens[dispositivoLexML.tagName] = this.cntSubitens[dispositivoLexML.tagName] ? this.cntSubitens[dispositivoLexML.tagName] + 1 : 1;
      Severity: Minor
      Found in src/lexml/exportarParaLexML.js and 1 other location - About 55 mins to fix
      src/lexml/exportarParaLexML.js on lines 80..80

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

      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

                  this.cntSubitens[dispositivoLexML.tagName] = this.cntSubitens[dispositivoLexML.tagName] ? this.cntSubitens[dispositivoLexML.tagName] + 1 : 1;
      Severity: Minor
      Found in src/lexml/exportarParaLexML.js and 1 other location - About 55 mins to fix
      src/lexml/exportarParaLexML.js on lines 157..157

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

      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 criarElementoLexML has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function criarElementoLexML(tipo, conteudo, idPai, idxFilho, unico, nEmenda, rotulos) {
      Severity: Major
      Found in src/lexml/exportarParaLexML.js - About 50 mins to fix

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

                        if (!container) {
                            container = new Artigo('', contexto.textoAnterior);
                            contexto.artigos.push(container);
                            contexto.textoAnterior = '';
                        }
        Severity: Minor
        Found in src/interpretadorArticulacao.js and 1 other location - About 50 mins to fix
        src/interpretadorArticulacao.js on lines 122..126

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

        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

                        if (!container) {
                            container = new Artigo('', contexto.textoAnterior);
                            contexto.artigos.push(container);
                            contexto.textoAnterior = '';
                        }
        Severity: Minor
        Found in src/interpretadorArticulacao.js and 1 other location - About 50 mins to fix
        src/interpretadorArticulacao.js on lines 105..109

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

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

        function substituirSet() {
            function substituirMetodo(metodo) {
                if (typeof SetNativo.prototype[metodo] === 'function') {
                    window.Set.prototype[metodo] = function() { return this.$set[metodo].apply(this.$set, arguments); };
                }
        Severity: Minor
        Found in src/hacks/ie.js - 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 interceptarApos has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function interceptarApos(objeto, metodo, interceptador) {
            if (!objeto) throw 'Objeto não fornecido.';
            if (!metodo) throw 'Método não fornecido.';
            if (!interceptador) throw 'Interceptador não fornecido.';
        
        
        Severity: Minor
        Found in src/hacks/interceptador.js - 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 interceptar has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function interceptar(objeto, metodo, interceptador) {
            if (!objeto) throw 'Objeto não fornecido.';
            if (!metodo) throw 'Método não fornecido.';
            if (!interceptador) throw 'Interceptador não fornecido.';
        
        
        Severity: Minor
        Found in src/hacks/interceptador.js - 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

        Avoid deeply nested control flow statements.
        Open

                                if (item instanceof tipo[j]) {
                                    return item;
                                }
        Severity: Major
        Found in src/interpretadorArticulacao.js - About 45 mins to fix

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

          function aoColar(event, clipboardCtrl) {
              var clipboardData = event.clipboardData || window.clipboardData;
              var itens = clipboardData.items;
          
              if (itens) {
          Severity: Minor
          Found in src/ClipboardController.js - 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

          Avoid deeply nested control flow statements.
          Open

                                  if (regexp.reiniciar) {
                                      contexto.ultimoItem = null;
                                  }
          Severity: Major
          Found in src/interpretadorArticulacao.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                            do {
                                startContainer = startContainer.firstElementChild;
                            } while (startContainer.firstElementChild);
            Severity: Major
            Found in src/EditorArticulacaoController.js - About 45 mins to fix

              Function criarRotuloLexML has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function criarRotuloLexML(tipo, numero, unico, nEmenda, rotulos) {
              Severity: Minor
              Found in src/lexml/exportarParaLexML.js - About 35 mins to fix

                Function processarEstado has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function processarEstado(event, _parser, _estadoParser, controller, elemento) {
                Severity: Minor
                Found in src/transformacaoAutomatica/transformacaoAutomatica.js - About 35 mins to fix

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

                          for (let i in this.cursor) {
                              if (this.cursor[i] !== obj2.cursor[i]) {
                                  return true;
                              }
                          }
                  Severity: Minor
                  Found in src/ContextoArticulacao.js and 1 other location - About 35 mins to fix
                  src/ContextoArticulacao.js on lines 126..130

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

                  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 in this.permissoes) {
                              if (this.permissoes[i] !== obj2.permissoes[i]) {
                                  return true;
                              }
                          }
                  Severity: Minor
                  Found in src/ContextoArticulacao.js and 1 other location - About 35 mins to fix
                  src/ContextoArticulacao.js on lines 120..124

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

                  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