File index.js
has 386 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { ExtendedJSON, SessionManager } from '/client/imports/modules';
import { ReactivityProvider } from '/client/imports/facades';
import $ from 'jquery';
import Helper from '/client/imports/helpers/helper';
import { QueryRender } from '/client/imports/ui/querying';
Function init
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
init({
selector, data, empty = true,
options = { create_option: true, allow_single_deselect: true, persistent_create_option: true, skip_no_results: true },
sortDataByKey = true,
prependOptions,
- 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 setAutoCompletionOfCodeMirror
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const setAutoCompletionOfCodeMirror = function (autoCompleteListMethod) {
CodeMirror.hint.javascript = (editor) => {
const cursor = editor.getCursor();
const currentLine = editor.getLine(cursor.line);
let start = cursor.ch;
- 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 displayJsonEditorModal
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const displayJsonEditorModal = function (sData) {
let dataToSet = ExtendedJSON.convertAndCheckJSON(_.unescape(sData));
dataToSet = dataToSet.ERROR ? _.unescape(sData) : dataToSet;
let modal = $('#json-editor-modal');
Function initializeCodeMirror
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
initializeCodeMirror({ divSelector, txtAreaId, keepValue = false, height = 100, noResize = false, extraKeysToAppend = {}, autoCompleteListMethod }) {
if (!divSelector || !(divSelector instanceof $) || !txtAreaId) return;
if (autoCompleteListMethod && typeof autoCompleteListMethod !== 'function') return;
if (extraKeysToAppend && (typeof extraKeysToAppend !== 'object' || extraKeysToAppend.constructor !== Object)) return;
if (!height || typeof height !== 'number' || !Number.isFinite(height)) return;
- 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 initializeCodeMirrorFirstTime
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
const initializeCodeMirrorFirstTime = function (txtAreaId, extraKeysToAppend, keepValue, height, autoCompleteListMethod, noResize) {
Consider simplifying this complex logical expression. Open
if (!selectorString || !Array.isArray(columns) || !Array.isArray(columnDefs) || !Array.isArray(data) || !Array.isArray(lengthMenu) || (typeof extraOptions !== 'object')) { return; }