oddbit/sonosjs

View on GitHub

Showing 23 of 46 total issues

Function httpServer has 164 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function httpServer() {
            var that = {};
            var serverSocketRegistry = {};
            var httpRequests = {};

Severity: Major
Found in src/net/environments/chrome.js - About 6 hrs to fix

Function mediaController has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function mediaController() {
            var that = {};

            /**
             * Make a http request to a sonos device and ask for the current media state (i.e. what song
Severity: Major
Found in src/mediaController.js - About 5 hrs to fix

Function exports has 118 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (grunt) {
    "use strict";

    var buildOptions = {
        debug: false
Severity: Major
Found in Gruntfile.js - About 4 hrs to fix

Function sonosController has 118 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function sonosController() {
            var that = {};

            var multicastGroupSocket = 0;

Severity: Major
Found in src/sonosController.js - About 4 hrs to fix

File chrome.js has 363 lines of code (exceeds 250 allowed). Consider refactoring.
Open

define(function (require) {
        "use strict";

        var convert = require("net/convert");
        var httpResponse = require("net/http/response");
Severity: Minor
Found in src/net/environments/chrome.js - About 4 hrs to fix

Function tcp has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function tcp() {
            var that = {};
            var socketRegistry = {};

            /**
Severity: Major
Found in src/net/environments/chrome.js - About 3 hrs to fix

Function udp has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function udp() {
            var that = {};
            var socketRegistry = {};

            /**
Severity: Major
Found in src/net/environments/chrome.js - About 3 hrs to fix

Function upnpService has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function upnpService() {
            var that = {};
            var httpServerSocket = 0;

            that.startEventServer = function () {
Severity: Major
Found in src/upnpService.js - About 3 hrs to fix

Function xmlParser has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function xmlParser(opts) {
            opts = opts || {};
            var that = {};
            var parser = sax.parser(opts.strict || true, opts);
            var excludeNamespace = opts.excludeNamespace || true;
Severity: Major
Found in src/utils/xml.js - About 2 hrs to fix

Function httpHeader has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function httpHeader(opts) {
            opts = opts || {};
            var that = {};

            var headers = opts.headers || [];
Severity: Major
Found in src/net/http/header.js - About 2 hrs to fix

Function deviceService has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function deviceService() {
            var that = {};
            var devices = [];

            /**
Severity: Major
Found in src/deviceService.js - About 2 hrs to fix

Function lastChange has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function lastChange(opts) {
            opts = opts || {};

            var that = {};

Severity: Major
Found in src/models/state.js - About 2 hrs to fix

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

            function onReceive(info) {
                var clientSocket = info.socketId;

                if (!httpRequests.hasOwnProperty(clientSocket)) {
                    return;
Severity: Minor
Found in src/net/environments/chrome.js - About 1 hr to fix

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

            (function init() {
                switch (playState) {
                case "PLAYING":
                    that.playState = playStateType.PLAYING;
                    break;
Severity: Minor
Found in src/models/state.js - About 1 hr to fix

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

            that.open = function (options, callback) {
                options = options || {};

                var ip = options.remoteIp;
                var port = Number(options.remotePort);
Severity: Minor
Found in src/net/environments/chrome.js - About 1 hr to fix

Function httpRequest has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function httpRequest(opts) {
            opts = opts || {};

            var that = {};
            var expectedLength = 0;
Severity: Minor
Found in src/net/http/request.js - About 1 hr to fix

Function device has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function device(opts) {
            opts = opts || {};

            /**
             * @typedef {object} device
Severity: Minor
Found in src/models/device.js - About 1 hr to fix

Function eventManager has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function eventManager() {
            var that = {};
            var eventCallbacks = {};

            that.action = {
Severity: Minor
Found in src/utils/event.js - About 1 hr to fix

Function register has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            that.register = function (device) {
                if (device.haveSubscriptions()) {
                    return;
                }

Severity: Minor
Found in src/upnpService.js - About 1 hr to fix

Function makeBuildConfig has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function makeBuildConfig() {
        return {
            options: {
                baseUrl: "./src",
                name: "almond",
Severity: Minor
Found in Gruntfile.js - About 1 hr to fix
Severity
Category
Status
Source
Language