wilzbach/msa

View on GitHub

Showing 149 of 149 total issues

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

  show: function() {
    this.isVisible = false;
    this.$el.find(".msa-scale-minimised").addClass(this.toggleClass);
    this.$el.find(".msa-scale-maximised").removeClass(this.toggleClass);
  },
Severity: Major
Found in src/views/ScaleSlider.js and 1 other location - About 2 hrs to fix
src/views/ScaleSlider.js on lines 88..92

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

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

  render: function() {
    this._createCanvas();
    this.el.textContent = "overview";
    this.el.style.marginTop = this.g.zoomer.get("overviewboxPaddingTop");

Severity: Minor
Found in src/views/OverviewBox.js - About 1 hr to fix

    Function showTree has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        showTree: function(newickStr) {
          var newick = window.require("biojs-io-newick");
          var mt = window.require("msa-tnt");
    
          if (typeof newickStr === "string") {
    Severity: Minor
    Found in src/utils/tree.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

    Function render has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render: function() {
        dom.removeAllChilds(this.el);
    
        this.el.style.display = "inline-block";
    
    
    Severity: Minor
    Found in src/views/labels/MetaView.js - About 1 hr to fix

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

        _onmousein: function(evt) {
          var rowPos = this.g.zoomer.get("stepSize" * evt.rowPos);
          return this.g.trigger("bar:mousein", {rowPos: rowPos, evt:evt});
        },
      Severity: Major
      Found in src/views/header/ConservationView.js and 3 other locations - About 1 hr to fix
      src/views/header/ConservationView.js on lines 167..170
      src/views/header/GapView.js on lines 92..95
      src/views/header/GapView.js on lines 97..100

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

      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

      function getURLParameter(name) {
        return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [, ""])[1].replace(/\+/g, '%20')) || null;
      }
      Severity: Major
      Found in snippets/msa_show_menu.js and 1 other location - About 1 hr to fix
      snippets/fer1.js on lines 26..28

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

      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

      function getURLParameter(name) {
          return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [, ""])[1].replace(/\+/g, '%20')) || null;
      }
      Severity: Major
      Found in snippets/fer1.js and 1 other location - About 1 hr to fix
      snippets/msa_show_menu.js on lines 29..31

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

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

        _onmousein: function(evt) {
          var rowPos = this.g.zoomer.get("stepSize" * evt.rowPos);
          return this.g.trigger("gap:mousein", {rowPos: rowPos, evt:evt});
        },
      Severity: Major
      Found in src/views/header/GapView.js and 3 other locations - About 1 hr to fix
      src/views/header/ConservationView.js on lines 162..165
      src/views/header/ConservationView.js on lines 167..170
      src/views/header/GapView.js on lines 97..100

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

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

        _onmouseout: function(evt) {
          var rowPos = this.g.zoomer.get("stepSize" * evt.rowPos);
          return this.g.trigger("gap:mouseout", {rowPos: rowPos, evt:evt});
        }
      Severity: Major
      Found in src/views/header/GapView.js and 3 other locations - About 1 hr to fix
      src/views/header/ConservationView.js on lines 162..165
      src/views/header/ConservationView.js on lines 167..170
      src/views/header/GapView.js on lines 92..95

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

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

        _onmouseout: function(evt) {
          var rowPos = this.g.zoomer.get("stepSize" * evt.rowPos);
          return this.g.trigger("bar:mouseout", {rowPos: rowPos, evt:evt});
        }
      Severity: Major
      Found in src/views/header/ConservationView.js and 3 other locations - About 1 hr to fix
      src/views/header/ConservationView.js on lines 162..165
      src/views/header/GapView.js on lines 92..95
      src/views/header/GapView.js on lines 97..100

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

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

        render: function() {
          dom.removeAllChilds(this.el);
      
          this.el.style.width = `${this.g.zoomer.getLabelWidth()}px`;
          //@el.style.height = "#{@g.zoomer.get "rowHeight"}px"
      Severity: Minor
      Found in src/views/labels/LabelView.js - About 1 hr to fix

        Function initialize has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          initialize: function(data) {
            this.g = data.g;
        
            this.listenTo(this.g.zoomer, "change:_alignmentScrollLeft change:_alignmentScrollTop", function(model,value, options) {
              if ((!(((typeof options !== "undefined" && options !== null) ? options.origin : undefined) != null)) || options.origin !== "canvasseq") {
        Severity: Minor
        Found in src/views/canvas/CanvasSeqBlock.js - About 1 hr to fix

          Function _buildM has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _buildM: function(data) {
              let displayedButton, frag, key, li, node, style, _ref;
              let nodes = data.nodes;
              let name = data.name;
              let menu = document.createElement("div");
          Severity: Minor
          Found in src/menu/menulib.js - About 1 hr to fix

            Function colorer has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              colorer: function(colorRange) {
                let colorer = function() { return "none" };
            
                if( typeof colorRange === 'string' ) {
                  colorer = function() { return colorRange };
            Severity: Minor
            Found in src/views/header/ConservationView.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

            Function render has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              render: function() {
                var conserv = this.g.stats.scale(this.g.stats.conservation());
            
                dom.removeAllChilds(this.el);
            
            
            Severity: Minor
            Found in src/views/header/ConservationView.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

            Function render has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render: function() {
                this.setName("Export");
            
                this.addNode("Share view (URL)" + ShareSym, () => {
                  return Exporter.shareLink(this.msa, function(link) {
            Severity: Minor
            Found in src/menu/views/ExportMenu.js - About 1 hr to fix

              Function getBlocksForRow has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                getBlocksForRow: function(seqId, maxLen) {
                  const selis = this.filter(function(el) { return el.inRow(seqId); });
                  let blocks = [];
                  for (let i = 0, seli; i < selis.length; i++) {
                    let seli = selis[i];
              Severity: Minor
              Found in src/g/selection/SelectionCol.js - About 1 hr to fix

                Function genConservedSequences has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  genConservedSequences: (len, seqLen, dict) => {
                    const seqs = [];
                    if (!(typeof len !== "undefined" && len !== null)) { len = BMath.getRandomInt(3,5); }
                    if (!(typeof seqLen !== "undefined" && seqLen !== null)) { seqLen = BMath.getRandomInt(50,200); }
                
                
                Severity: Minor
                Found in src/utils/seqgen.js - About 1 hr to fix

                  Function invertCol has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    invertCol: function(columns) {
                      const selColumns = this.where({type:"column"}).reduce((memo,el) => {
                        return memo.concat(((() => {
                          const result = [];
                          let i = el.attributes.xStart;
                  Severity: Minor
                  Found in src/g/selection/SelectionCol.js - About 1 hr to fix

                    Function _onmousemove has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                      _onmousemove: function(e, reversed) {
                        if (this.dragStart.length === 0) { return; }
                    
                        const dragEnd = mouse.abs(e);
                        // relative to first click
                    Severity: Minor
                    Found in src/views/canvas/CanvasSeqBlock.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

                    Severity
                    Category
                    Status
                    Source
                    Language