Showing 67 of 86 total issues
Function colarFragmento
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function colarFragmento(fragmento, editorCtrl, validacaoCtrl) {
prepararDesfazer(fragmento, editorCtrl);
let proximaSelecao = fragmento.lastChild;
let selecao = editorCtrl.getSelection();
Function normalizarParagrafo
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function normalizarParagrafo(paragrafo) {
while (paragrafo.hasAttributes()) {
paragrafo.removeAttribute(paragrafo.attributes[0].name);
}
- 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 prepararDesfazer
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function prepararDesfazer(fragmento, editorCtrl) {
var copia = [];
for (let i = 0, l = fragmento.childNodes.length; i < l; i++) {
copia.push(fragmento.childNodes[i]);
Function polyfill
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function polyfill() {
// IE 11 não tem Object.assing
// Object polyfill from https://developer.mozilla.org/en-US/docs/Glossary/Polyfill
if (!Object.assign) {
Function constructor
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(elemento, opcoes) {
var container, botoes, containerBotoes, ctrl;
/* Se houver suporte ao shadow-dom, então vamos usá-lo
* para garantir o isolamento da árvore interna do componente
Function obterSelecao
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function obterSelecao(ctrl) {
var selecao = ctrl.getSelection();
var range = selecao && selecao.rangeCount > 0 ? selecao.getRangeAt(0) : null;
if (range) {
Function criarRotuloLexML
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function criarRotuloLexML(tipo, numero, unico, nEmenda, rotulos) {
var elemento = document.createElementNS('http://www.lexml.gov.br/1.0', 'Rotulo');
switch (tipo) {
case 'Artigo':
Function atualizarContexto
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
atualizarContexto() {
var elementoSelecionado = obterSelecao(this);
if (!elementoSelecionado) {
if (!this.contexto) {
- 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 prepararDesfazer
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function prepararDesfazer(fragmento, editorCtrl) {
var copia = [];
for (let i = 0, l = fragmento.childNodes.length; i < l; i++) {
copia.push(fragmento.childNodes[i]);
- 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 criarConteudoInline
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function criarConteudoInline(origem, destino) {
var arvore = document.createTreeWalker(origem, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, null /* necesário no IE 11 */, null /* necesário no IE 11 */);
var atual = {
/**
* Objeto de contexto de exportação anterior (este mesmo objeto)
- 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 criarConteudoInline
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function criarConteudoInline(origem, destino) {
var arvore = document.createTreeWalker(origem, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, null /* necesário no IE 11 */, null /* necesário no IE 11 */);
var atual = {
/**
* Objeto de contexto de exportação anterior (este mesmo objeto)
Function transformarTextoPuro
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function transformarTextoPuro(texto, tipo) {
if (texto.length === 0) {
return;
}
Function constructor
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(elemento, opcoes) {
if (!(elemento instanceof Element)) {
throw 'Elemento não é um elemento do DOM.';
}
Function exports
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (config) {
config.set({
files: ['empacotamento/karma.js', 'test/karma/**/*.js'],
frameworks: ['jasmine'],
preprocessors: {
Function interpretarArticulacao
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function interpretarArticulacao(texto, formatoDestino, formatoOrigem) {
var json;
try {
switch ((formatoOrigem || 'texto').toLowerCase()) {
Function verificarPrimeiroDoTipo
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function verificarPrimeiroDoTipo(dispositivo) {
var tipo = dispositivo.getAttribute('data-tipo');
if (!tipo) {
return null;
Function transformarEmEditor
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function transformarEmEditor(elemento, editorCtrl, opcoes) {
let style = document.createElement('style');
style.innerHTML = css.toString().replace(/\${(.+?)}/g, (m, valor) => opcoes.rotulo[valor]);
/* Se houver suporte ao shadow-dom, então vamos usá-lo
Function transformarEmLexML
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function transformarEmLexML(json) {
function reducaoInciso(prev, inciso, idx, array) {
var idInciso = array.prefixo + "_inc" + (idx + 1);
Function constructor
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
constructor(elemento, opcoes) {
if (!(elemento instanceof Element)) {
throw 'Elemento não é um elemento do DOM.';
}
- 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 transformarEmEditor
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function transformarEmEditor(elemento, editorCtrl, opcoes) {
let style = document.createElement('style');
style.innerHTML = css.toString().replace(/\${(.+?)}/g, (m, valor) => opcoes.rotulo[valor]);
/* Se houver suporte ao shadow-dom, então vamos usá-lo
- 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"