src/hacks/chrome.js
Function hackInterceptarKeydown
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
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).
- 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 hackInterceptarKeydown
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
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).
Consider simplifying this complex logical expression. Open
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 hackAlterarTipo
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
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"