Showing 7 of 35 total issues
File update-each-liquid.py
has 2167 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import json, requests
liquids = [
{
"_id": "57bc9ffd6df8bbae1fa34d85",
File station.controller.js
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
app.controller('StationCtrl', ['$rootScope', '$scope', '$state', '$q','$localStorage',
'stationService', 'liquidService', 'typeService', 'WebSocket',
function($rootScope, $scope, $state, $q, $localStorage, stationService,
liquidService, typeService, WebSocket) {
Function addLiquidToStation
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
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)) {
Function sendCommand
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
Consider simplifying this complex logical expression. Open
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;
Function sendCommand
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function sendCommand(guiConnection, station_host, station_port, command, commandData) {
Function exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function (socket) {
console.log('Socket.IO Connection Established');
socket.on('message', function (message) {
// keep connection alive
if (message === 'PING') {
- 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"