prasadtalasila/BITS-Darshini

View on GitHub

Showing 651 of 651 total issues

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

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

    public String analyze() {
        // Initializing session and protocol
        //log.info("Starting to analyze ..........");
        init(pcapPath);
        graphParser = context.getBean(ProtocolGraphParser.class);
src/main/java/in/ac/bits/protocolanalyzer/mvc/controller/SessionController.java on lines 48..67

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

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

    @RequestMapping(value = "/analysis", method = RequestMethod.GET)
    public @ResponseBody String analyze(
            @RequestParam("graph") String protocolGraphStr,
            @RequestParam("pcapPath") String pcapPath) {
        // Initializing session and protocol
src/main/java/in/ac/bits/protocolanalyzer/mvc/controller/Experiment.java on lines 52..66

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

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

    public static short parseBytesshort(byte[] bytes)
            throws ArrayIndexOutOfBoundsException {
        if (bytes.length > 2) {
            throw new ArrayIndexOutOfBoundsException(
                    "Byte array length exceeds 4!");
src/main/java/in/ac/bits/protocolanalyzer/utils/ByteOperator.java on lines 20..33

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

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

        } else if (mode.equalsIgnoreCase("hex4")) {
            String hexString = Hex.encodeHexString(bytes);
            StringBuilder builder = new StringBuilder();
            for (int i = 0; i < hexString.length(); i += 4) {
                builder.append(hexString.substring(i, i + 4));
src/main/java/in/ac/bits/protocolanalyzer/utils/Beautify.java on lines 26..36

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

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

    public static byte parseBytesbyte(byte[] bytes)
            throws ArrayIndexOutOfBoundsException {
        if (bytes.length > 1) {
            throw new ArrayIndexOutOfBoundsException(
                    "Byte array length exceeds 4!");
src/main/java/in/ac/bits/protocolanalyzer/utils/ByteOperator.java on lines 35..48

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

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

        } else if (mode.equalsIgnoreCase("hex2")) {
            String hexString = Hex.encodeHexString(bytes);
            StringBuilder builder = new StringBuilder();
            for (int i = 0; i < hexString.length(); i += 2) {
                builder.append(hexString.substring(i, i + 2));
src/main/java/in/ac/bits/protocolanalyzer/utils/Beautify.java on lines 36..45

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

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 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);

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

package in.ac.bits.protocolanalyzer.analyzer.link;

public final class EthernetHeader {
  public static final int DST_ADDR_START_BIT = 0;

src/main/java/in/ac/bits/protocolanalyzer/analyzer/transport/IcmpHeader.java on lines 1..29

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

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 in.ac.bits.protocolanalyzer.analyzer.transport;

public final class IcmpHeader {
  public static final int TYPE__START_BIT = 0;

src/main/java/in/ac/bits/protocolanalyzer/analyzer/link/EthernetHeader.java on lines 1..29

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

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 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");

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

    dashboardViewDisplay: function(){
        _this = this;
        loginCheck(function(result) {
            if (result) {
             view = new DashboardView();
Severity: Major
Found in src/main/webapp/WEB-INF/js/main.js and 4 other locations - About 1 hr to fix
src/main/webapp/WEB-INF/js/main.js on lines 63..71
src/main/webapp/WEB-INF/js/main.js on lines 72..80
src/main/webapp/WEB-INF/js/main.js on lines 81..89
src/main/webapp/WEB-INF/js/main.js on lines 90..98

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

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

    experimentViewDisplay: function () {    
        _this = this;
        loginCheck(function(result) {
            if (result) {
             view = new ExperimentView();
Severity: Major
Found in src/main/webapp/WEB-INF/js/main.js and 4 other locations - About 1 hr to fix
src/main/webapp/WEB-INF/js/main.js on lines 72..80
src/main/webapp/WEB-INF/js/main.js on lines 81..89
src/main/webapp/WEB-INF/js/main.js on lines 90..98
src/main/webapp/WEB-INF/js/main.js on lines 99..107

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

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

    loadViewDisplay: function(){
        _this = this;
        loginCheck(function(result) {
            if (result) {
             view = new LoadView();
Severity: Major
Found in src/main/webapp/WEB-INF/js/main.js and 4 other locations - About 1 hr to fix
src/main/webapp/WEB-INF/js/main.js on lines 63..71
src/main/webapp/WEB-INF/js/main.js on lines 72..80
src/main/webapp/WEB-INF/js/main.js on lines 81..89
src/main/webapp/WEB-INF/js/main.js on lines 99..107

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

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

Severity
Category
Status
Source
Language