nutella-framework/nutella_framework

View on GitHub

Showing 96 of 196 total issues

Function show has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Tooltip.prototype.show = function () {
    var e = $.Event('show.bs.' + this.type)

    if (this.hasContent() && this.enabled) {
      this.$element.trigger(e)
Severity: Major
Found in framework_components/room-debugger/js/bootstrap.js - About 2 hrs to fix

Consider simplifying this complex logical expression.
Open

        if (   typeof newPayload === "string" 
            || newPayload instanceof ArrayBuffer
            || newPayload instanceof Int8Array
            || newPayload instanceof Uint8Array
            || newPayload instanceof Int16Array
Severity: Critical
Found in framework_components/room-debugger/js/nutella_lib.js - About 2 hrs to fix

Function slide has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Carousel.prototype.slide = function (type, next) {
    var $active   = this.$element.find('.item.active')
    var $next     = next || this.getItemForDirection(type, $active)
    var isCycling = this.interval
    var direction = type == 'next' ? 'left' : 'right'
Severity: Minor
Found in framework_components/room-debugger/js/bootstrap.js - About 1 hr to fix

Function _disconnected has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    ClientImpl.prototype._disconnected = function (errorCode, errorText) {
        this._trace("Client._disconnected", errorCode, errorText);
        
        this.sendPinger.cancel();
        this.receivePinger.cancel();
Severity: Minor
Found in framework_components/room-debugger/js/nutella_lib.js - About 1 hr to fix

Function parseUTF8 has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function parseUTF8(input, offset, length) {
        var output = "";
        var utf16;
        var pos = offset;

Severity: Minor
Found in framework_components/room-debugger/js/nutella_lib.js - About 1 hr to fix

Function LocationSubModule has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var LocationSubModule = function(main_nutella) {
    this.nutella = main_nutella;

    this._resources = {};
    this._room = undefined;
Severity: Minor
Found in framework_components/room-debugger/js/nutella_lib.js - About 1 hr to fix

Function show has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Modal.prototype.show = function (_relatedTarget) {
    var that = this
    var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })

    this.$element.trigger(e)
Severity: Minor
Found in framework_components/room-debugger/js/bootstrap.js - About 1 hr to fix

Method start_app_bots has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def self.start_app_bots( app_id, app_path )
    app_bots_list = Nutella.current_app.config['app_bots']
    bots_dir = "#{app_path}/bots/"
    # If app bots have been started already, then do nothing
    unless Nutella::Tmux.session_exist? Nutella::Tmux.app_bot_session_name app_id
Severity: Minor
Found in lib/commands/util/components_starter.rb - About 1 hr 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

Function backdrop has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Modal.prototype.backdrop = function (callback) {
    var that = this
    var animate = this.$element.hasClass('fade') ? 'fade' : ''

    if (this.isShown && this.options.backdrop) {
Severity: Minor
Found in framework_components/room-debugger/js/bootstrap.js - About 1 hr to fix

Function activate has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Tab.prototype.activate = function (element, container, callback) {
    var $active    = container.find('> .active')
    var transition = callback
      && $.support.transition
      && (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length)
Severity: Minor
Found in framework_components/room-debugger/js/bootstrap.js - About 1 hr to fix

Function 1 has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.NUTELLA = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/******************
 * nutella_lib.js *
 ******************/

Severity: Minor
Found in framework_components/room-debugger/js/nutella_lib.js - About 1 hr to fix

Function show has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Collapse.prototype.show = function () {
    if (this.transitioning || this.$element.hasClass('in')) return

    var activesData
    var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
Severity: Minor
Found in framework_components/room-debugger/js/bootstrap.js - About 1 hr to fix

Function subscribe_to has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

AbstractNet.prototype.subscribe_to = function(channel, callback, appId, runId, done_callback) {
    // Pad channel
    var padded_channel = this.pad_channel(channel, appId, runId);
    // Maintain unique subscriptions
    if(this.subscriptions.indexOf(padded_channel)>-1)
Severity: Minor
Found in framework_components/room-debugger/js/nutella_lib.js - About 1 hr to fix

Function 11 has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{}],11:[function(require,module,exports){
/**
 * Run-level Logging APIs for nutella
 */

Severity: Minor
Found in framework_components/room-debugger/js/nutella_lib.js - About 1 hr to fix

Function 4 has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./app_log":4,"./app_net":5}],4:[function(require,module,exports){
/**
 * App-level log APIs for nutella
 */

Severity: Minor
Found in framework_components/room-debugger/js/nutella_lib.js - About 1 hr to fix

Function 7 has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./fr_log":7,"./fr_net":8}],7:[function(require,module,exports){
/**
 * Framework-level log APIs for nutella
 */

Severity: Minor
Found in framework_components/room-debugger/js/nutella_lib.js - About 1 hr to fix

Function restore has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    ClientImpl.prototype.restore = function(key) {        
        var value = localStorage.getItem(key);
        var storedMessage = JSON.parse(value);
        
        var wireMessage = new WireMessage(storedMessage.type, storedMessage);
Severity: Minor
Found in framework_components/room-debugger/js/nutella_lib.js - About 1 hr to fix

Function md51_array has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    md51_array = function (a) {
        var n = a.length,
            state = [1732584193, -271733879, -1732584194, 271733878],
            i,
            length,
Severity: Minor
Found in framework_components/room-debugger/js/nutella_lib.js - About 1 hr to fix

Function md51 has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    md51 = function (s) {
        var n = s.length,
            state = [1732584193, -271733879, -1732584194, 271733878],
            i,
            length,
Severity: Minor
Found in framework_components/room-debugger/js/nutella_lib.js - About 1 hr to fix

Method validate_template has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_template( dir )
      # Parse and validate the template's nutella.json file
      begin
        template_nutella_file_json = JSON.parse(IO.read("#{dir}/nutella.json"))
      rescue
Severity: Minor
Found in lib/commands/meta/template_command.rb - About 1 hr 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

Severity
Category
Status
Source
Language