theopenbar/interface

View on GitHub

Showing 7 of 35 total issues

File update-each-liquid.py has 2167 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import json, requests

liquids = [
  {
    "_id": "57bc9ffd6df8bbae1fa34d85",
Severity: Major
Found in utility-generate-types/update-each-liquid.py - About 6 days to fix

    File station.controller.js has 290 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    app.controller('StationCtrl', ['$rootScope', '$scope', '$state', '$q','$localStorage',
        'stationService', 'liquidService', 'typeService', 'WebSocket',
        function($rootScope, $scope, $state, $q, $localStorage, stationService,
            liquidService, typeService, WebSocket) {
    
    
    Severity: Minor
    Found in public/scripts/controllers/station.controller.js - About 2 hrs to fix

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

              $scope.addLiquidToStation = function() {
                  $scope.messageSuccess = null;
                  // check that liquid is fully filled in (i.e. has an ID assigned, and an amount if a connected liquid)
                  if($scope.liquidSelection.id == null
                      || ($scope.liquidSelection.amount == null && $scope.selectedValve != null)) {
      Severity: Minor
      Found in public/scripts/controllers/station.controller.js - About 1 hr to fix

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

        function sendCommand(guiConnection, station_host, station_port, command, commandData) {
            var client = new net.Socket();
            client.connect(station_port, station_host,
                function() {
                    console.log('CONNECTED TO STATION: ' + station_host + ':' + station_port);
        Severity: Minor
        Found in routes/commander.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                                      if(connLiquid.id._id == liquid.id._id
                                      || (connLiquid.id.type == liquid.id.type && liquid.id.subtype == "*Any")
                                      || (connLiquid.id.type == liquid.id.type && connLiquid.id.subtype == liquid.id.subtype && liquid.id.brand == "*Any")
                                      || !liquid.requirement) return true;
                                      else return false;
          Severity: Major
          Found in routes/station.js - About 1 hr to fix

            Function sendCommand has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function sendCommand(guiConnection, station_host, station_port, command, commandData) {
            Severity: Minor
            Found in routes/commander.js - About 35 mins to fix

              Function exports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports = function (socket) {
                  console.log('Socket.IO Connection Established');
                  socket.on('message', function (message) {
                      // keep connection alive
                      if (message === 'PING') {
              Severity: Minor
              Found in routes/commander.js - About 25 mins 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