markdown-note/markdown-notes

View on GitHub
src/browser/notebooks/notebook-client.js

Summary

Maintainability
D
2 days
Test Coverage

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) {
Severity: Major
Found in src/browser/notebooks/notebook-client.js - About 1 day to fix

    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) {
    Severity: Minor
    Found in src/browser/notebooks/notebook-client.js - About 5 hrs to fix

    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

    File notebook-client.js has 275 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* jshint esnext: true */
    'use strict';
    
    var _i18n = require('i18n');
    var _async = require('async');
    Severity: Minor
    Found in src/browser/notebooks/notebook-client.js - About 2 hrs to fix

      Function showTab has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function showTab(notebookID, updateActiveNotebook, cbMain) {
          // Fetch the notebook details
          _notebooks.getFullDetailByID(notebookID, function(err, notebookData) {
            if (err) {
              err.display();
      Severity: Minor
      Found in src/browser/notebooks/notebook-client.js - About 1 hr to fix

        Function _initDisplay has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function _initDisplay() {
            var openNotebooks = _notebooks.getLastOpenedNotebooks();
            if (openNotebooks) {
              // Show the last open notebooks.
              _async.each(openNotebooks, function(notebookID, cbMain) {
        Severity: Minor
        Found in src/browser/notebooks/notebook-client.js - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status