Showing 278 of 361 total issues
Method to_html
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def to_html
if @options.has_key?(:reverse) && @options[:reverse] == true
my_pagination = pagination.reverse
else
my_pagination = pagination
- 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
Avoid deeply nested control flow statements. Open
Open
if (stream.eat(/[a-zA-Z$@_]/)) {
stream.eatWhile(/[\w]/);
// Only one ? ! = is allowed and only as the last character
stream.eat(/[\?\!\=]/);
return "atom";
Avoid deeply nested control flow statements. Open
Open
if (stream.eat(/[\+\-\*\/\&\|\:\!]/)) {
return "atom";
}
Function easeInOutBack
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
easeInOutBack: function (x, t, b, c, d, s) {
Avoid deeply nested control flow statements. Open
Open
if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state);
Function easeInBack
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
easeInBack: function (x, t, b, c, d, s) {
Avoid deeply nested control flow statements. Open
Open
if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state);
Function easeOutBack
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
easeOutBack: function (x, t, b, c, d, s) {
Avoid deeply nested control flow statements. Open
Open
} else if (ch == "@" && stream.match(/^@?[a-zA-Z_]/)) {
stream.eat("@");
stream.eatWhile(/[\w]/);
return "variable-2";
} else if (ch == "$") {
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;
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 (sp.marker.collapsed && !sp.marker.replacedWith && sp.from == span.to &&
(sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
lineIsHiddenInner(doc, line, sp)) return true;
Consider simplifying this complex logical expression. Open
Open
if (target == display.scrollbarH || target == display.scrollbarH.firstChild ||
target == display.scrollbarV || target == display.scrollbarV.firstChild ||
target == display.scrollbarFiller || target == display.gutterFiller) return null;
Function markTextShared
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function markTextShared(doc, from, to, options, type) {
Function buildTokenMeasure
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function buildTokenMeasure(builder, text, style, startStyle, endStyle) {
Function buildLineElement
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function buildLineElement(cm, line, lineNo, dims, reuse) {
Function charIdxInLine
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function charIdxInLine(start, line, character, forward, includeChar) {
Function dialog
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function dialog(cm, template, shortText, onClose, options) {
Function coordsCharInner
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function coordsCharInner(cm, lineObj, lineNo, x, y) {
Function countColumn
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function countColumn(string, end, tabSize, startIndex, startValue) {