prasadtalasila/BITS-Darshini

View on GitHub

Showing 32 of 651 total issues

Method elasticsearchTemplate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Bean
    public ElasticsearchOperations elasticsearchTemplate() {
        String clusterName = environment
                .getProperty("elasticsearch.cluster.name");
        String nodeName = environment.getProperty("elasticsearch.node.name");

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

             success:function (data) {
                 var jsonData = JSON.parse(data);
                 var status = jsonData.status;
                 if(status === "success") {
                    $.ajax({
Severity: Minor
Found in src/main/webapp/WEB-INF/js/views/experiment-view.js - About 1 hr to fix

Function login has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Method calculateMetrics has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void calculateMetrics() {

        log.info("==========================================");
        log.info("Session Name : " + sessionName);
        log.info("Pcap Path: " + pcapPath);

Function loginCheck has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function loginCheck(callback) {
     $.ajax({
            url:'/protocolanalyzer/auth',
             type:'GET',
             contentType: 'application/json; charset=utf-8',
Severity: Minor
Found in src/main/webapp/WEB-INF/js/main.js - About 1 hr to fix

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

    @Override
    public void run() {
        this.isRunning = true;
        while (!buckets.isEmpty()) {

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

Avoid deeply nested control flow statements.
Open

                  for(var prop=0;prop<values.length;prop++){
                    for(var i=0;i < _this._layers.length-1;i++){   
                      if(_this._layers[i]===values[prop]){
                        matchOneLayerToNext++;
                      }
Severity: Major
Found in src/main/webapp/WEB-INF/js/views/config-playground-view.js - About 45 mins to fix

Method bitToByte has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    private static byte bitToByte(byte[] original, int lower, int higher,
            int extraBits, boolean reverse) {
Severity: Minor
Found in src/main/java/in/ac/bits/protocolanalyzer/utils/BitOperator.java - About 35 mins to fix

Method configureSessionCells has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public void configureSessionCells(Session session) {
        if (protocolGraph == null) {
            log.info("protocolgraph is null in Protocolgraph!!");
        } else {
            for (Entry<String, Set<String>> entry : protocolGraph.entrySet()) {
Severity: Minor
Found in src/main/java/in/ac/bits/protocolanalyzer/protocol/ProtocolGraph.java - About 35 mins 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 multiGet has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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

Avoid too many return statements within this method.
Open

                return "INVALID-ADDRESS";
Severity: Major
Found in src/main/java/in/ac/bits/protocolanalyzer/utils/Beautify.java - About 30 mins to fix

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

    @Override
    public void run() {
        while (isRunning) {
            if (!isProcessing) {
                if (!inputQueue.isEmpty()) {
Severity: Minor
Found in src/main/java/in/ac/bits/protocolanalyzer/analyzer/AnalyzerCell.java - About 25 mins 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

Severity
Category
Status
Source
Language