prasadtalasila/BITS-Darshini

View on GitHub

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

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

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

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

Function fillTable has a Cognitive Complexity of 12 (exceeds 5 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

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 run has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

            @Override
            public void run() {
                while (!queries.isEmpty()) {
                    int size = currentBucket.size();
                    // log.info(">> AnalysisRepository: " +

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 beautify has 35 lines of code (exceeds 25 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

Method start has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

            @Override

Function success has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      success:function (data) {
          var jsonData = JSON.parse(JSON.stringify(data)).hits.hits;
          for(var id=1; id<=jsonData.length;id+=1){
            if (jsonData[id-1]._source.experimenter==Cookies.get('userName')) {
              LoadView.globalMy.push(jsonData[id-1]);
Severity: Minor
Found in src/main/webapp/WEB-INF/js/views/load-view.js - About 1 hr to fix

Function rowClick has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    rowClick: function(event) {
    $("#shareWrap *").removeAttr("disabled");
    $("#noneop").attr("disabled", "disabled");
    document.getElementById('loadExperiment').disabled = false;
    document.getElementById('shareExperiment').disabled = false;
Severity: Minor
Found in src/main/webapp/WEB-INF/js/views/load-view.js - About 1 hr to fix

Function analysis has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    analysis : function(event){
        event.preventDefault();
    _this = this;
    var pcapPath = sessionStorage.getItem('pcapPath');
    $.ajax({
Severity: Minor
Found in src/main/webapp/WEB-INF/js/views/config-playground-view.js - About 1 hr to fix

Method readFile has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public long readFile() {

        String sysFile = this.pcapPath;
        try {
            PcapHandle handle = Pcaps.openOffline(sysFile);
Severity
Category
Status
Source
Language