theopenbar/interface

View on GitHub

Showing 35 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    app.controller('loginController',['$scope', '$location', 'AuthService',
        function ($scope, $location, AuthService) {
            $scope.login = function () {
                // initial values
                $scope.error = false;
    Severity: Major
    Found in public/scripts/controllers/login.controller.js and 1 other location - About 1 day to fix
    public/scripts/controllers/register.controller.js on lines 1..23

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 210.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    app.controller('registerController', ['$scope', '$location', 'AuthService',
        function ($scope, $location, AuthService) {
            $scope.register = function () {
                // initial values
                $scope.error = false;
    Severity: Major
    Found in public/scripts/controllers/register.controller.js and 1 other location - About 1 day to fix
    public/scripts/controllers/login.controller.js on lines 1..23

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 210.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      router.post('/types', function(req, res) {
          var type = new Type(req.body);
          
          type.save(function (err, status) {
              if (err) return res.status(500).json({err: err});
      Severity: Major
      Found in routes/type.js and 2 other locations - About 2 hrs to fix
      routes/liquid.js on lines 5..12
      routes/recipe.js on lines 13..21

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 92.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      router.post('/save', function(req, res) {
          var liquid = new Liquid(req.body);
      
          liquid.save(function (err, status) {
              if (err) return res.status(500).json({err: err});
      Severity: Major
      Found in routes/liquid.js and 2 other locations - About 2 hrs to fix
      routes/recipe.js on lines 13..21
      routes/type.js on lines 13..20

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 92.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      router.post('/save', function(req, res) {
          var recipe = new Recipe(req.body);
      
          recipe.save(function (err, status) {
              if (err) return res.status(500).json({err: err});
      Severity: Major
      Found in routes/recipe.js and 2 other locations - About 2 hrs to fix
      routes/liquid.js on lines 5..12
      routes/type.js on lines 13..20

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 92.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              this.getLiquid = function(id) {
                  var deferred = $q.defer();
      
                  var Liquid = $resource('/api/liquid/:id', {id: id});
      
      
      Severity: Major
      Found in public/scripts/services/liquid.service.js and 1 other location - About 2 hrs to fix
      public/scripts/services/station.service.js on lines 4..12

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 84.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          this.getStation = function(station_id) {
              var deferred = $q.defer();
      
              var Station = $resource('/api/station/:id', {id: station_id});
              Station.get(function(station){
      Severity: Major
      Found in public/scripts/services/station.service.js and 1 other location - About 2 hrs to fix
      public/scripts/services/liquid.service.js on lines 44..54

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 84.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

                      $scope.liquidSelection.brands = brands.reduceRight(function (r, a) {
                          r.some(function (b) { return a.brand === b.brand; }) || r.push(a);
                          return r;
                      }, []);
      Severity: Major
      Found in public/scripts/controllers/liquid.controller.js and 1 other location - About 2 hrs to fix
      public/scripts/controllers/recipe.controller.js on lines 212..215

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 82.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

                          $scope.liquidSelection.brands = brands.reduceRight(function (r, a) {
                              r.some(function (b) { return a.brand === b.brand; }) || r.push(a);
                              return r;
                          }, []);
      Severity: Major
      Found in public/scripts/controllers/recipe.controller.js and 1 other location - About 2 hrs to fix
      public/scripts/controllers/liquid.controller.js on lines 75..78

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 82.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              this.saveLiquid = function(liquid) {
                  var deferred = $q.defer();
      
                  var Liquids = $resource('/api/liquid/save');
                  Liquids.post(liquid, function(status){
      Severity: Major
      Found in public/scripts/services/liquid.service.js and 1 other location - About 2 hrs to fix
      public/scripts/services/recipe.service.js on lines 4..13

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 77.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              this.saveRecipe = function(recipe) {
                  var deferred = $q.defer();
      
                  var Recipe = $resource('/api/recipe/save');
                  Recipe.put(recipe, function(recipe){
      Severity: Major
      Found in public/scripts/services/recipe.service.js and 1 other location - About 2 hrs to fix
      public/scripts/services/liquid.service.js on lines 20..29

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 77.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

                      $scope.liquidSelection = {"subtypes": [], "brands": [], "descriptions": [], "amounts": [],
                                                  "id":null, "type":null, "subtype":null, "brand":null,"description":null,
                                                  "amount": null, "pressurized": false};
      Severity: Major
      Found in public/scripts/controllers/station.controller.js and 1 other location - About 1 hr to fix
      public/scripts/controllers/station.controller.js on lines 7..9

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 70.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

              $scope.liquidSelection = {"subtypes": [], "brands": [], "descriptions": [],"amounts": [],
                                          "id":null, "type":null, "subtype":null, "brand":null,"description":null,
                                          "amount": null, "pressurized": false};
      Severity: Major
      Found in public/scripts/controllers/station.controller.js and 1 other location - About 1 hr to fix
      public/scripts/controllers/station.controller.js on lines 248..250

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 70.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                       $scope.liquidSelection.id = $scope.liquidSelection.descriptions.filter(function(v) {
                              return v.description === $scope.liquidSelection.description;
                      })[0]._id;
          Severity: Major
          Found in public/scripts/controllers/recipe.controller.js and 1 other location - About 1 hr to fix
          public/scripts/controllers/station.controller.js on lines 93..96

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 63.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              Liquid.find(req.body).exec(function (err, descriptions) {
                  if (err) {
                      console.log(err);
                      return res.status(500).json({err: err});
                  }
          Severity: Major
          Found in routes/liquid.js and 1 other location - About 1 hr to fix
          routes/station.js on lines 32..39

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 63.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                       $scope.liquidSelection.id =
                          $scope.liquidSelection.descriptions.filter(function(v) {
                              return v.description === $scope.liquidSelection.description;
                      })[0]._id;
          Severity: Major
          Found in public/scripts/controllers/station.controller.js and 1 other location - About 1 hr to fix
          public/scripts/controllers/recipe.controller.js on lines 51..53

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 63.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language