prasadtalasila/BITS-Darshini

View on GitHub

Showing 651 of 651 total issues

Function graphValidation has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
Open

  graphValidation : function(){
    var f = document.getElementById("fileInput").files[0];
    var editor = ace.edit("editor");
    var pre = editor.getSession().getValue();
    _this = this;
Severity: Minor
Found in src/main/webapp/WEB-INF/js/views/config-playground-view.js - About 1 day 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

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

          for(var id=1; id<=LoadView.globalMy.length;id+=1){    //index of array starts from 0
          var td, tr;
          var tdata = $("#expListMy tbody")
          tr = $("<tr>");
          td = $("<td>").text(id);
Severity: Major
Found in src/main/webapp/WEB-INF/js/views/load-view.js and 1 other location - About 7 hrs to fix
src/main/webapp/WEB-INF/js/views/load-view.js on lines 52..64

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

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(var id=1; id<=LoadView.globalShared.length;id+=1){    //index of array starts from 0
          var td, tr;
          var tdata = $("#expListShared tbody")
          tr = $("<tr>");
          td = $("<td>").text(id);
Severity: Major
Found in src/main/webapp/WEB-INF/js/views/load-view.js and 1 other location - About 7 hrs to fix
src/main/webapp/WEB-INF/js/views/load-view.js on lines 39..51

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

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

  graphValidation : function(){
    var f = document.getElementById("fileInput").files[0];
    var editor = ace.edit("editor");
    var pre = editor.getSession().getValue();
    _this = this;
Severity: Major
Found in src/main/webapp/WEB-INF/js/views/config-playground-view.js - About 4 hrs to fix

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

    $(function() {
      $("#slider").slider({
        range: "max",
        min: 20,
        max: 1000,
Severity: Major
Found in src/main/webapp/WEB-INF/js/views/config-playground-view.js and 3 other locations - About 4 hrs to fix
src/main/webapp/WEB-INF/js/views/analysis-view.js on lines 144..156
src/main/webapp/WEB-INF/js/views/experiment-view.js on lines 94..106
src/main/webapp/WEB-INF/js/views/load-view.js on lines 183..195

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

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

          $(function() {
            $("#slider").slider({
              range: "max",
              min: 20,
              max: 1000,
Severity: Major
Found in src/main/webapp/WEB-INF/js/views/analysis-view.js and 3 other locations - About 4 hrs to fix
src/main/webapp/WEB-INF/js/views/config-playground-view.js on lines 206..218
src/main/webapp/WEB-INF/js/views/experiment-view.js on lines 94..106
src/main/webapp/WEB-INF/js/views/load-view.js on lines 183..195

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

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

    $(function() {
      $("#slider").slider({
        range: "max",
        min: 20,
        max: 1000,
Severity: Major
Found in src/main/webapp/WEB-INF/js/views/load-view.js and 3 other locations - About 4 hrs to fix
src/main/webapp/WEB-INF/js/views/analysis-view.js on lines 144..156
src/main/webapp/WEB-INF/js/views/config-playground-view.js on lines 206..218
src/main/webapp/WEB-INF/js/views/experiment-view.js on lines 94..106

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

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

            $(function() {
                $("#slider").slider({
                    range: "max",
                    min: 20,
                    max: 1000,
Severity: Major
Found in src/main/webapp/WEB-INF/js/views/experiment-view.js and 3 other locations - About 4 hrs to fix
src/main/webapp/WEB-INF/js/views/analysis-view.js on lines 144..156
src/main/webapp/WEB-INF/js/views/config-playground-view.js on lines 206..218
src/main/webapp/WEB-INF/js/views/load-view.js on lines 183..195

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

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

      function validator(code, type) { 
          var flag =0;
          //test graph is the main graph, user graph checked against this
          //ECMA 6 : replace with backticks , is cleaner
          var testGraph = 'graph start {'+
Severity: Major
Found in src/main/webapp/WEB-INF/js/views/config-playground-view.js - About 3 hrs to fix

Method start has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public void start() {
        log.info("Starting analysis repository...");
        TimerTask pull = new TimerTask() {

            @Override

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

  @Subscribe
  public void analyze(PacketWrapper packetWrapper) {
    if (Protocol.get("ETHERNET").equalsIgnoreCase(packetWrapper.getPacketType())) {
      setEthernetHeader(packetWrapper);
      String nextPacketType = setNextProtocolType();
src/main/java/in/ac/bits/protocolanalyzer/analyzer/transport/IcmpAnalyzer.java on lines 80..97

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

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

  @Subscribe
  public void analyze(PacketWrapper packetWrapper) {
    if (Protocol.get("ICMP").equalsIgnoreCase(packetWrapper.getPacketType())) {
      setIcmpHeader(packetWrapper);
      String nextPacketType = setNextProtocolType();
src/main/java/in/ac/bits/protocolanalyzer/analyzer/link/EthernetAnalyzer.java on lines 77..94

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

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

        render: function () {
          $(this.el).html(this.template());

          //slider initialization  
          $(function() {
Severity: Major
Found in src/main/webapp/WEB-INF/js/views/analysis-view.js - About 2 hrs to fix

Method parse has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static byte[] parse(byte[] header, int startBit, int endBit)
            throws IllegalArgumentException {

        // check if start and end bits are within the range of header
        int byteStartBit = 0;
Severity: Major
Found in src/main/java/in/ac/bits/protocolanalyzer/utils/BitOperator.java - About 2 hrs to fix

Function newExperiment has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        newExperiment : function(event) {
            event.preventDefault();
            var formValues = {
                experimentName : $('#experimentName').val(),
                description : $('#description').val(),
Severity: Minor
Found in src/main/webapp/WEB-INF/js/views/experiment-view.js - About 1 hr to fix

Method beautify has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static String beautify(byte[] bytes, String mode)
            throws IllegalArgumentException {

        if (mode.equalsIgnoreCase("ip4")) {
            if (bytes.length != 4) {
Severity: Minor
Found in src/main/java/in/ac/bits/protocolanalyzer/utils/Beautify.java - About 1 hr 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

Method parse has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static byte[] parse(byte[] header, int startBit, int endBit)
            throws IllegalArgumentException {

        // check if start and end bits are within the range of header
        int byteStartBit = 0;
Severity: Minor
Found in src/main/java/in/ac/bits/protocolanalyzer/utils/BitOperator.java - About 1 hr 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

Function fillTable has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    fillTable : function(event) {
      $.ajax({
      url:'http://localhost:9200/protocol/info/_search',
      type:'POST',
      data : '{"from":0,"size":200,"query":{"multi_match":{"query":"'+Cookies.get('userName')+'","fields":["experimenter","collaborators"]}}}',
Severity: Minor
Found in src/main/webapp/WEB-INF/js/views/load-view.js - About 1 hr to fix

Method testGetterSetter has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Test
    public void testGetterSetter() {

        String sessionName = "session_1234";
        String pcapPath = "path/to/pcap/file.pcap";

Function multiGet has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    multiGet : function(startId,endId,layerCount){
      startId = Number(startId);
      endId = Number(endId);
      layerCount = Number(layerCount);
      if(endId > sessionStorage.getItem('packetCount')){
Severity: Minor
Found in src/main/webapp/WEB-INF/js/views/analysis-view.js - About 1 hr to fix
Severity
Category
Status
Source
Language