patrickfav/indoor-positioning

View on GitHub

Showing 365 of 365 total issues

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

                scope.$watch('width', function(newVal,oldVal) {
                    console.log("graph width: "+scope.width);
                    element.children().css("width",scope.width);
                    s.refresh();
                    $window.dispatchEvent(new Event('resize')); //hack so that it will be shown instantly
Severity: Major
Found in src/main/webapp/js/modules/sigmajs-ng.js and 1 other location - About 2 hrs to fix
src/main/webapp/js/modules/sigmajs-ng.js on lines 42..47

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

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

                scope.$watch('height', function(newVal,oldVal) {
                    console.log("graph height: "+scope.height);
                    element.children().css("height",scope.height);
                    s.refresh();
                    $window.dispatchEvent(new Event('resize'));//hack so that it will be shown instantly
Severity: Major
Found in src/main/webapp/js/modules/sigmajs-ng.js and 1 other location - About 2 hrs to fix
src/main/webapp/js/modules/sigmajs-ng.js on lines 36..41

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

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 addSensor has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function addSensor (paper,graphGroup,mac,name,x,y,isManagedNode) {
            var group = new paper.Group();
            var vertex = new paper.Shape.Circle(new paper.Point(x, y),state.getTileLenPx());
            if(isManagedNode) {
                vertex.fillColor = '#C0392B';
Severity: Major
Found in src/main/webapp/js/modules/signalmap/signalmap-inits.js - About 2 hrs to fix

    Method equals has a Cognitive Complexity of 19 (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

    Method printSparseMatrix has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        public static String printSparseMatrix(SparseObjectMatrix2D matrix2D, String srcMac) {
            StringBuilder sb = new StringBuilder();
            sb.append("Representation of mac: ").append(srcMac).append("\n");
            for (int i = 0; i < matrix2D.columns(); i++) {
                for (int j = 0; j < matrix2D.rows(); j++) {

    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 SignalMap.java has 272 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package at.ac.tuwien.inso.indoor.sensorserver.persistence.model.measurement;
    
    import java.util.*;
    
    /**

      ServerConfig has 23 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public final class ServerConfig extends TypeAbleCouchDBDocument {
          @JsonIgnore
          private static Logger log = LogManager.getLogger(ServerConfig.class);
      
          @JsonIgnore

        SignalMapConfig has 23 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public class SignalMapConfig {
            private int tileLenghtCm = 10;
        
            private int defaultSpreadExtendedNodesCm = 70;
            private int defaultSpreaManagedNodesCm = 120;

          SimpleStatistics has 23 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public class SimpleStatistics {
              private Double mean = 0d;
              private Double median = 0d;
              private Double mode = 0d;
              private Double variance = 0d;

            Method calculatePosition has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public ExtendedNodePositionWrapper calculatePosition() {
                    ExtendedNodePositionWrapper wrapper = new ExtendedNodePositionWrapper();
            
                    data = new NodeDistanceMatrix(analysis, range);
            
            

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

                      var divId = 'signal-map-'+Math.floor((Math.random() * 999999999999))+'-'+Math.floor((Math.random() * 999999999999))+'-'+Math.floor((Math.random() * 999999999999));
              Severity: Major
              Found in src/main/webapp/js/modules/signalmap/signalmap-directive.js and 1 other location - About 2 hrs to fix
              src/main/webapp/js/modules/sigmajs-ng.js on lines 5..5

              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

                      var divId = 'sigmjs-dir-container-'+Math.floor((Math.random() * 999999999999))+'-'+Math.floor((Math.random() * 999999999999))+'-'+Math.floor((Math.random() * 999999999999));
              Severity: Major
              Found in src/main/webapp/js/modules/sigmajs-ng.js and 1 other location - About 2 hrs to fix
              src/main/webapp/js/modules/signalmap/signalmap-directive.js on lines 5..5

              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

              Method run has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                      @Override
                      public void run() {
                          final double incrementStep = getAppropriateIncrementStep(0.001);
              
                          log.info(Thread.currentThread().getName() + ": Start mult calibrating with increment steps of " + incrementStep + "  and estimated " + Math.pow((UPPER_BOUND - initialValue) * 2 / incrementStep, modifieableEntries.size()) + " cycles");

              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

              package at.ac.tuwien.inso.indoor.sensorserver.persistence.model.pathloss;
              
              /**
               * Created by PatrickF on 03.11.2014.
               */
              src/main/java/at/ac/tuwien/inso/indoor/sensorserver/persistence/model/network/OUIMacInfo.java on lines 1..61

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

              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

              package at.ac.tuwien.inso.indoor.sensorserver.persistence.model.network;
              
              /**
               * Created by PatrickF on 06.10.2014.
               */
              src/main/java/at/ac/tuwien/inso/indoor/sensorserver/persistence/model/pathloss/BruteforceMultInfo.java on lines 1..63

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

              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 fillMap has 59 lines of code (exceeds 25 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);

                SignalMap has 22 methods (exceeds 20 allowed). Consider refactoring.
                Open

                public class SignalMap {
                    private int tileLengthCm;
                    private int lengthX;
                    private int lengthY;
                    private int spreadCmExtendedNodes;

                  Adapter has 22 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  public class Adapter implements Comparable<Adapter> {
                      private String name;
                      private String ssid;
                      private Integer channel;
                      private Integer txPowerDbm;

                    File MiscManager.java has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    package at.ac.tuwien.inso.indoor.sensorserver.persistence.manager;
                    
                    import at.ac.tuwien.inso.indoor.sensorserver.persistence.dao.MiscDao;
                    import at.ac.tuwien.inso.indoor.sensorserver.persistence.model.JobLog;
                    import at.ac.tuwien.inso.indoor.sensorserver.persistence.model.PingLog;

                      Method findNetwork has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public List<SensorNetwork> findNetwork(Map<String, SimpleMeasurement> measurements) {
                      
                              Map<SensorNetwork, Integer> probabilityMap = new HashMap<SensorNetwork, Integer>();
                      
                              for (SensorNetwork network : SensorManager.getInstance().getAllSensorNetworksNonDeleted()) {

                      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