Showing 144 of 144 total issues
Function NoteEditor
has a Cognitive Complexity of 103 (exceeds 5 allowed). Consider refactoring. Open
var NoteEditor = function() {
const NOTE_COMPLETE_CLASS = 'complete';
const DEFAULT_NOTE_CLASS = 'note';
const NOTE_NOT_EDITABLE_CLASS = 'readonly';
const NOTE_TO_BE_MOVED = 'modified';
- 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 NoteEditor
has 285 lines of code (exceeds 25 allowed). Consider refactoring. Open
var NoteEditor = function() {
const NOTE_COMPLETE_CLASS = 'complete';
const DEFAULT_NOTE_CLASS = 'note';
const NOTE_NOT_EDITABLE_CLASS = 'readonly';
const NOTE_TO_BE_MOVED = 'modified';
Function NoteClient
has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring. Open
var NoteClient = function() {
var currentlyFocusedNote = null;
function _init() {
// Initialize note events with callback events.
- 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 NoteClient
has 269 lines of code (exceeds 25 allowed). Consider refactoring. Open
var NoteClient = function() {
var currentlyFocusedNote = null;
function _init() {
// Initialize note events with callback events.
Function Notes
has 264 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Notes = function() {
/**
* Fetches the notes present in the given notebook.
* @param {String} notebookID Notebook ID
* @param {function} cbMain Callback method that is sent an errror object
Function Notes
has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring. Open
var Notes = function() {
/**
* Fetches the notes present in the given notebook.
* @param {String} notebookID Notebook ID
* @param {function} cbMain Callback method that is sent an errror object
- 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 NotebooksClient
has 257 lines of code (exceeds 25 allowed). Consider refactoring. Open
var NotebooksClient = function() {
var notebooksContainerUL, notebooksTabHeading, notebooksTabContainer;
const EMPTY_NOTES_CLASS = 'empty-notebook';
function _init(cbMain) {
Function NoteEvents
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
var NoteEvents = function() {
var _noteHandler = {};
var _eventProperties = ['isEditable', 'isComplete', 'isReadOnly'];
function init(noteCallbackMethods) {
- 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 NoteEvents
has 174 lines of code (exceeds 25 allowed). Consider refactoring. Open
var NoteEvents = function() {
var _noteHandler = {};
var _eventProperties = ['isEditable', 'isComplete', 'isReadOnly'];
function init(noteCallbackMethods) {
Function Settings
has 162 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Settings = function() {
var appSettings = null;
var loadSettings = function() {
try {
Function NotebookEvents
has 149 lines of code (exceeds 25 allowed). Consider refactoring. Open
var NotebookEvents = function() {
var containerUL = null;
var tabHeading = null;
var tabContainer = null;
var client = null;
Function Notebooks
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Notebooks = function() {
const OPEN_NOTEBOOKS = 'open-notebooks';
const CURRENT_OPEN_NOTEBOOK = 'current-notebook';
/**
Function NotebooksClient
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
var NotebooksClient = function() {
var notebooksContainerUL, notebooksTabHeading, notebooksTabContainer;
const EMPTY_NOTES_CLASS = 'empty-notebook';
function _init(cbMain) {
- 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 Utility
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Utility = function() {
var loadPartial = function(partialName, data, callback) {
loadTemplateFile(partialName, false, data, callback);
};
Function Utility
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
var Utility = function() {
var loadPartial = function(partialName, data, callback) {
loadTemplateFile(partialName, false, data, callback);
};
- 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 NotebookEvents
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
var NotebookEvents = function() {
var containerUL = null;
var tabHeading = null;
var tabContainer = null;
var client = null;
- 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 Settings
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
var Settings = function() {
var appSettings = null;
var loadSettings = function() {
try {
- 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 'handleTextModifier' has too many statements (43). Maximum allowed is 30. Open
function handleTextModifier(note, modifierType) {
- Read upRead up
- Exclude checks
enforce a maximum number of statements allowed in function blocks (max-statements)
The max-statements
rule allows you to specify the maximum number of statements allowed in a function.
function foo() {
var bar = 1; // one statement
var baz = 2; // two statements
var qux = 3; // three statements
}
Rule Details
This rule enforces a maximum number of statements allowed in function blocks.
Options
This rule has a number or object option:
-
"max"
(default10
) enforces a maximum number of statements allows in function blocks
Deprecated: The object property maximum
is deprecated; please use the object property max
instead.
This rule has an object option:
-
"ignoreTopLevelFunctions": true
ignores top-level functions
max
Examples of incorrect code for this rule with the default { "max": 10 }
option:
/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11; // Too many.
}
let foo = () => {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11; // Too many.
};
Examples of correct code for this rule with the default { "max": 10 }
option:
/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
return function () {
// The number of statements in the inner function does not count toward the
// statement maximum.
return 42;
};
}
let foo = () => {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
return function () {
// The number of statements in the inner function does not count toward the
// statement maximum.
return 42;
};
}
ignoreTopLevelFunctions
Examples of additional correct code for this rule with the { "max": 10 }, { "ignoreTopLevelFunctions": true }
options:
/*eslint max-statements: ["error", 10, { "ignoreTopLevelFunctions": true }]*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11;
}
Related Rules
- [complexity](complexity.md)
- [max-depth](max-depth.md)
- [max-len](max-len.md)
- [max-nested-callbacks](max-nested-callbacks.md)
- [max-params](max-params.md) Source: http://eslint.org/docs/rules/
Function SettingEvents
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
var SettingEvents = function() {
var settingsClient;
var dlg = null;
var allTabs = null;
var allTabAnchors = null;
File note-editor.js
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*****************************************************************
* Contains code to determine and change the current state
* of the note. For example to determine when the note is
* currently editable, complete and to make it editable.
* Only deals with the DOM side of things.