Showing 67 of 86 total issues
Function transformar
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function transformar(texto, tipo, continuacao) {
var fragmento;
if (continuacao) {
fragmento = transformarTextoPuro(texto, 'continuacao');
- Read upRead up
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 alterarTipoDispositivoSelecionado
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
alterarTipoDispositivoSelecionado(novoTipo) {
this.atualizarContexto();
if (!this.contexto) {
throw 'Não há contexto atual.';
- Read upRead up
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 _normalizarDispositivo
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_normalizarDispositivo(dispositivo, contexto) {
while (dispositivo && !dispositivo.hasAttribute('data-tipo')) {
dispositivo = dispositivo.parentElement;
}
- Read upRead up
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 possuiSubtipo
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
possuiSubtipo(subtipo) {
switch (this.tipo) {
case 'Articulacao':
return subtipo === 'Artigo' || subtipo === 'Titulo' || subtipo === 'Capitulo' || subtipo === 'Secao' || subtipo === 'Livro' || subtipo === 'Parte';
Function criarElementoLexML
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function criarElementoLexML(tipo, conteudo, idPai, idxFilho, unico, nEmenda, rotulos) {
var elemento, id;
id = tipo.substr(0, 3).toLowerCase();
id = idPai ? idPai + '_' + id : id;
Function hackInterceptarKeydown
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function hackInterceptarKeydown(keyboardEvent, editorCtrl) {
/* Somente serão tratadas as alterações de conteúdo. Portanto,
* se houver qualquer tecla modificativa (ctrl, alt ou meta),
* o evento será ignorado. O evento só será tratado se a tecla for
* de conteúdo (letra, número ou enter), ou remoção (delete, backspace).
Function obterDispositivoAnterior
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function obterDispositivoAnterior(dispositivo, elementoArticulacao) {
while (dispositivo && !dispositivo.hasAttribute('data-tipo') && dispositivo !== elementoArticulacao) {
dispositivo = dispositivo.parentElement;
}
- Read upRead up
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 _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') {
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();
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',
- Read upRead up
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);
- Read upRead up
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 criarElementoLexML
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function criarElementoLexML(tipo, conteudo, idPai, idxFilho, unico, nEmenda, rotulos) {
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); };
}
- Read upRead up
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.';
- Read upRead up
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.';
- Read upRead up
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;
}
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) {
- Read upRead up
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;
}
Avoid deeply nested control flow statements. Open
do {
startContainer = startContainer.firstElementChild;
} while (startContainer.firstElementChild);
Function criarRotuloLexML
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function criarRotuloLexML(tipo, numero, unico, nEmenda, rotulos) {