Showing 177 of 219 total issues
Avoid deeply nested control flow statements. Open
Open
for (++j; j < i && countsAsNum.test(types[j]); ++j) {}
Function updateDocInner
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function updateDocInner(cm, from, to, newText, selUpdate, origin) {
Avoid deeply nested control flow statements. Open
Open
if (m.collapsed && (!collapsed || collapsed.marker.width < m.width))
collapsed = sp;
Avoid deeply nested control flow statements. Open
Open
if (m.endStyle && sp.to == nextChange) spanEndStyle += " " + m.endStyle;
Avoid deeply nested control flow statements. Open
Open
if (atMediaTypes[stream.current()]) {
style = "attribute"; // Known attribute
} else if (/^(only|not)$/i.test(stream.current())) {
style = "keyword";
} else if (stream.current().toLowerCase() == "and") {
Avoid deeply nested control flow statements. Open
Open
} else if (context == "@mediaType") {
if (atMediaTypes[stream.current()]) {
style = "attribute";
} else if (stream.current().toLowerCase() == "and") {
style = "operator";
Function JSLexical
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function JSLexical(indented, column, type, align, prev, info) {
Avoid deeply nested control flow statements. Open
Open
} else if (sp.from > pos && nextChange > sp.from) {
nextChange = sp.from;
}
Method import_json
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def import_json json
data = json.is_a?(String) ? ActiveSupport::JSON.decode(json) : json.map(&:stringify_keys!)
import_destroy
- 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
Method resolve_with_interpolation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def resolve_with_interpolation key
if key.is_a? Symbol
scope = @scopes.detect { |s| s.key? key }
scope ||= @environments.detect { |s| s.key? key }
scope[key] if scope
- 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
Consider simplifying this complex logical expression. Open
Open
if (display.wheelStartX == null) {
display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
display.wheelDX = dx; display.wheelDY = dy;
setTimeout(function() {
if (display.wheelStartX == null) return;
Consider simplifying this complex logical expression. Open
Open
if (!cm.options.lineNumbers && !markers && !line.bgClass && !line.wrapClass &&
(!line.widgets || !line.widgets.length)) return lineElement;
Consider simplifying this complex logical expression. Open
Open
if (endsAfter || marker.type == "bookmark" && span.from == endCh && span.from != startCh) {
var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);
(nw || (nw = [])).push({from: startsBefore ? null : span.from - endCh,
to: span.to == null ? null : span.to - endCh,
marker: marker});
Consider simplifying this complex logical expression. Open
Open
if (cur &&
(history.lastOp == cm.curOp.id ||
history.lastOrigin == origin && (origin == "input" || origin == "delete") &&
history.lastTime > time - 600)) {
// Merge this change into the last event
Consider simplifying this complex logical expression. Open
Open
if ((sp.from == null || sp.from < ch) &&
(sp.to == null || sp.to > ch) &&
(!found || found.width < sp.marker.width))
found = sp.marker;
Function setSelection
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function setSelection(cm, anchor, head, bias, checkAtomic) {
Function markText
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function markText(cm, from, to, options, type) {
Function patchDisplay
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function patchDisplay(cm, from, to, intact, updateNumbersFrom) {
Function runMode
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function runMode(cm, text, mode, state, f) {
Function buildTokenMeasure
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function buildTokenMeasure(builder, text, style, startStyle, endStyle) {