patrickfav/indoor-positioning

View on GitHub

Showing 365 of 365 total issues

Consider simplifying this complex logical expression.
Open

        if (channel == 34 || channel == 36 || channel == 38 || channel == 40 || channel == 42 ||
                channel == 44 || channel == 46 || channel == 48 || channel == 52 || channel == 56 ||
                channel == 60 || channel == 64 || channel == 100 || channel == 104 || channel == 108 ||
                channel == 112 || channel == 116 || channel == 120 || channel == 124 || channel == 128 ||
                channel == 132 || channel == 136 || channel == 140 || channel == 149 || channel == 153 ||
Severity: Critical
Found in src/main/java/at/ac/tuwien/inso/indoor/sensorserver/util/RadioUtil.java - About 1 day to fix

    File node-detail.js has 468 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    angular.module('adminConsoleApp').controller('NodeDetailCtrl', ['$scope', '$http', 'navStatus', '$routeParams', '$modal', function ($scope, $http, navStatus, $routeParams, $modal) {
    
        $scope.networkId = "";
    Severity: Minor
    Found in src/main/webapp/js/node-detail.js - About 7 hrs to fix

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

              function reloadConfigData() {
                  navStatus.startLoading();
                  $http({
                      method: 'GET',
                      url: constants.getApiUrl() + "/config",
      Severity: Major
      Found in src/main/webapp/js/positioning.js and 1 other location - About 7 hrs to fix
      src/main/webapp/js/network-detail.js on lines 62..77

      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 175.

      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

          function reloadConfigData() {
              navStatus.startLoading();
              $http({
                  method: 'GET',
                  url: constants.getApiUrl() + "/config",
      Severity: Major
      Found in src/main/webapp/js/network-detail.js and 1 other location - About 7 hrs to fix
      src/main/webapp/js/positioning.js on lines 38..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 175.

      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

      Method createTrendInfo has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          private ExtendedNodeInfo.TrendInfo createTrendInfo(String scanNodeMac, ExtendedNodeInfo.ManagedNode managedNode, String networkId) {
              ExtendedNodeInfo.TrendInfo trendInfo = new ExtendedNodeInfo.TrendInfo();
      
              if (prevAnalysis != null && !prevAnalysis.isEmpty()) {
                  List<Double> prevValues = new ArrayList<Double>();

      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

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

          function setFloorplanBlueprintUrl() {
              if($scope.serverConfig.couchDBUrl && $scope.wrapper.network) {
                  for (var attachmentName in $scope.wrapper.network._attachments) {
                      if (attachmentName.indexOf("blueprint") > -1) {
                          $scope.wrapper.getFloorplanBlueprintSrc = $scope.serverConfig.couchDBUrl + "/" + $scope.wrapper.network._id + "/" + attachmentName + "?cache-control-rev=" + $scope.wrapper.network._attachments[attachmentName].revpos;
      Severity: Major
      Found in src/main/webapp/js/network-detail.js and 1 other location - About 6 hrs to fix
      src/main/webapp/js/positioning.js on lines 336..344

      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 160.

      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

              function setFloorplanBlueprintUrl() {
                  if ($scope.serverConfig.couchDBUrl && $scope.probablePositionsWrapper.network) {
                      for (var attachmentName in $scope.probablePositionsWrapper.network._attachments) {
                          if (attachmentName.indexOf("blueprint") > -1) {
                              $scope.probablePositionsWrapper.getFloorplanBlueprintSrc = $scope.serverConfig.couchDBUrl + "/" + $scope.probablePositionsWrapper.network._id + "/" + attachmentName + "?cache-control-rev=" + $scope.probablePositionsWrapper.network._attachments[attachmentName].revpos;
      Severity: Major
      Found in src/main/webapp/js/positioning.js and 1 other location - About 6 hrs to fix
      src/main/webapp/js/network-detail.js on lines 102..110

      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 160.

      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

      Method equals has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public boolean equals(Object o) {
              if (this == o) return true;
              if (o == null || getClass() != o.getClass()) return false;
      
      

      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

      File pathloss-edit.js has 375 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      (function() {
          'use strict';
      
          angular.module('adminConsoleApp').controller('PathLossModalCtrl', ['$scope', '$http', 'navStatus','$modalInstance','analysisService','$rootScope','localStorageService',
              function ($scope, $http, navStatus,$modalInstance,analysisService,$rootScope,localStorageService) {
      Severity: Minor
      Found in src/main/webapp/js/pathloss-edit.js - About 5 hrs to fix

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

                        for(mac in signalMap.managedNodes) {
                            node = signalMap.managedNodes[mac];
                            if(useOriginalPosition) {
                                node.currentPos = {x:node.originalPos.x,y:node.originalPos.y};
                            }
        Severity: Major
        Found in src/main/webapp/js/modules/signalmap/signalmap-inits.js and 1 other location - About 4 hrs to fix
        src/main/webapp/js/modules/signalmap/signalmap-inits.js on lines 70..76

        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 132.

        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

                        for(mac in signalMap.extendedNodes) {
                            node = signalMap.extendedNodes[mac];
                            if(useOriginalPosition) {
                                node.currentPos = {x:node.originalPos.x,y:node.originalPos.y};
                            }
        Severity: Major
        Found in src/main/webapp/js/modules/signalmap/signalmap-inits.js and 1 other location - About 4 hrs to fix
        src/main/webapp/js/modules/signalmap/signalmap-inits.js on lines 62..68

        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 132.

        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 3 locations. Consider refactoring.
        Open

            $scope.getRoomNameById = function(roomId) {
                if($scope.wrapper.roomList && roomId) {
                    for(var i=0;i<$scope.wrapper.roomList.rooms.length;i++) {
                        if($scope.wrapper.roomList.rooms[i].roomId == roomId) {
                            return $scope.wrapper.roomList.rooms[i].name;
        Severity: Major
        Found in src/main/webapp/js/network-details-analysis.js and 2 other locations - About 4 hrs to fix
        src/main/webapp/js/network-detail.js on lines 191..200
        src/main/webapp/js/node-detail.js on lines 45..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 131.

        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 3 locations. Consider refactoring.
        Open

            $scope.getRoomNameById = function(roomId) {
                if($scope.wrapper.roomList && roomId) {
                    for(var i=0;i<$scope.wrapper.roomList.rooms.length;i++) {
                        if($scope.wrapper.roomList.rooms[i].roomId == roomId) {
                            return $scope.wrapper.roomList.rooms[i].name;
        Severity: Major
        Found in src/main/webapp/js/network-detail.js and 2 other locations - About 4 hrs to fix
        src/main/webapp/js/network-details-analysis.js on lines 128..137
        src/main/webapp/js/node-detail.js on lines 45..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 131.

        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 3 locations. Consider refactoring.
        Open

            $scope.getRoomNameById = function (roomId) {
                if ($scope.wrapper.roomList && roomId) {
                    for (var i = 0; i < $scope.wrapper.roomList.rooms.length; i++) {
                        if ($scope.wrapper.roomList.rooms[i].roomId == roomId) {
                            return $scope.wrapper.roomList.rooms[i].name;
        Severity: Major
        Found in src/main/webapp/js/node-detail.js and 2 other locations - About 4 hrs to fix
        src/main/webapp/js/network-detail.js on lines 191..200
        src/main/webapp/js/network-details-analysis.js on lines 128..137

        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 131.

        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

        Method parseSpecificIwinfoAdapter has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            public static IwinfoAdapter parseSpecificIwinfoAdapter(String xml) throws Exception {
                try {
                    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                    DocumentBuilder builder = factory.newDocumentBuilder();
                    Document document = builder.parse(new InputSource(new StringReader(xml)));

        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

        Method getAverageFromSurvey has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            private static SurveyStatistics getAverageFromSurvey(List<Survey> surveys, String macAddress, EFrequencyRange frequencyRange, String networkId) {
                SensorNetwork sensorNetwork = SensorManager.getInstance().getSensorNetworkById(networkId);
        
                SurveyStatistics avgSurvey = new SurveyStatistics();
                avgSurvey.setMacAddress(macAddress);

        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

        Method fillMap has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            private Map<String, ExtendedNodeInfo> fillMap(String networkId, Map<String, PhysicalAdapter> physicalAdapterMap, List<Survey> surveyList) {
                Map<String, ExtendedNodeInfo> extendedNodeMap = new HashMap<String, ExtendedNodeInfo>();
        
                SensorNetwork sensorNetwork = SensorManager.getInstance().getSensorNetworkById(networkId);
                RoomList roomList = MiscManager.getInstance().getRoomlistByNetworkId(networkId);

        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

        MiscManager has 35 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public class MiscManager extends AManager {
        
            private static Logger log = LogManager.getLogger(MiscManager.class);
            private static MiscManager instance;
        
        

          SensorNode has 35 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public class SensorNode extends TypeAbleCouchDBDocument {
          
              private String nodeId;
              private String networkId;
              private String nodeName;

            Function loadSurveys has 109 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function loadSurveys(adapter) {
                    navStatus.startLoading();
                    if ($scope.surveys[adapter] != undefined) {
                        $scope.surveys[adapter].surveyChartConfig.loading = true;
                    } else {
            Severity: Major
            Found in src/main/webapp/js/node-detail.js - About 4 hrs to fix
              Severity
              Category
              Status
              Source
              Language