Showing 218 of 289 total issues
Function ./node_modules/react-styleguidist/lib/rsg-components/Editor/Editor.js
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
Open
"./node_modules/react-styleguidist/lib/rsg-components/Editor/Editor.js": function(
e,
t,
n
) {
- 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 insertLineContent
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function insertLineContent(e, t, n) {
var r = e.markedSpans,
o = e.text,
i = 0
if (r)
Function markText
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function markText(e, t, n, r, o) {
if (r && r.shared) return markTextShared(e, t, n, r, o)
if (e.cm && !e.cm.curOp) return operation(e.cm, markText)(e, t, n, r, o)
var i = new xe(e, o),
a = cmp(t, n)
Function pollContent
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(_e.prototype.pollContent = function() {
null != this.readDOMTimeout &&
(clearTimeout(this.readDOMTimeout), (this.readDOMTimeout = null))
var e = this.cm,
t = e.display,
Function onContextMenu
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(Ve.prototype.onContextMenu = function(e) {
function prepareSelectAllHack() {
if (null != o.selectionStart) {
var e = n.somethingSelected(),
i = "" + (e ? o.value : "")
Function onDrop
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function onDrop(e) {
var t = this
if (
(clearDragCursor(t),
!signalDOMEvent(t, e) && !eventInWidget(t.display, e))
Function d
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
d = (function() {
function kw(e) {
return { type: e, style: "keyword" }
}
var e = kw("keyword a"),
Function init
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
;(_e.prototype.init = function(e) {
function onCopyCut(e) {
if (!signalDOMEvent(r, e)) {
if (r.somethingSelected())
setLastCopied({ lineWise: !1, text: r.getSelections() }),
Function Display
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Display(e, t, r) {
var o = this
;(this.input = r),
(o.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler")),
o.scrollbarFiller.setAttribute("cm-not-content", "true"),
Function measureCharInner
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function measureCharInner(e, t, n, r) {
var o,
i = nodeAndOffsetInLineMap(t.map, n, r),
l = i.node,
c = i.start,
Function updateLineGutter
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function updateLineGutter(e, t, n, r) {
if (
(t.gutter && (t.node.removeChild(t.gutter), (t.gutter = null)),
t.gutterBackground &&
(t.node.removeChild(t.gutterBackground),
Consider simplifying this complex logical expression. Open
Open
if (a)
for (var s = 0; s < a.length; s++) {
var l = a[s]
;(null != l.to && o == e.line && e.ch >= l.to) ||
(null == l.from && o != e.line) ||
Consider simplifying this complex logical expression. Open
Open
if (((t.curOp.focus = activeElt()), !signalDOMEvent(t, e))) {
a && s < 11 && 27 == e.keyCode && (e.returnValue = !1)
var n = e.keyCode
t.display.shift = 16 == n || e.shiftKey
var r = handleKeyBinding(t, e)
Consider simplifying this complex logical expression. Open
Open
if (g.top - f.top <= 3) {
var x = (c ? v : m) && b,
C = (c ? m : v) && y ? s : (h ? f : g).left,
w = x ? l : (h ? g : f).right
add(C, f.top, w - C, f.bottom)
Consider simplifying this complex logical expression. Open
Open
if (
(o.lastOp == r ||
(o.lastOrigin == t.origin &&
t.origin &&
(("+" == t.origin.charAt(0) &&
Consider simplifying this complex logical expression. Open
Open
if (r.line >= e.display.viewFrom) {
var a = i.styles,
s =
i.text.length > e.options.maxHighlightLength
? copyState(t.mode, r.state)
Function buildToken
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function buildToken(e, t, n, r, o, i, l) {
if (t) {
var c,
u = e.splitSpaces ? splitSpaces(t, e.trailingSpace) : t,
d = e.cm.state.specialChars,
Function moveVisually
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function moveVisually(e, t, n, r) {
var o = getOrder(t, e.doc.direction)
if (!o) return moveLogically(t, n, r)
n.ch >= t.text.length
? ((n.ch = t.text.length), (n.sticky = "before"))
Function buildLineContent
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function buildLineContent(e, t) {
var n = eltP("span", null, null, l ? "padding-right: .1px" : null),
r = {
pre: eltP("pre", [n], "CodeMirror-line"),
content: n,
Function drawForLine
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function drawForLine(t, n, r) {
function coords(n, r) {
return charCoords(e, Pos(t, n), "div", u, r)
}
function wrapX(t, n, r) {