yannickwurm/sequenceserver

View on GitHub

Showing 7,450 of 7,450 total issues

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

        var gradScale = d3.scale
            .log()
            .domain([
                d3.min([1e-5, d3.min(hits.map(function (d) {
                    if (parseFloat(d.hitEvalue) === 0.0) return undefined;
Severity: Major
Found in public/js/hits_overview.js and 1 other location - About 4 hrs to fix
public/js/visualisation_helpers.js on lines 4..15

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

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

        return parentElement.selectAll('tile').data(function(d) {
            return d.values;
        }).enter().append('path').attr('class', 'tile').attr('opacity', function(d) {
            return d.opacity || conf.opacity;
        }).attr('d', d3.svg.arc().innerRadius(conf.innerRadius).outerRadius(conf.outerRadius).startAngle(function(d, i) {
Severity: Major
Found in public/packages/circosJS@1.7.0.js and 1 other location - About 4 hrs to fix
public/packages/circosJS@1.7.0.js on lines 700..706

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

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

        return parentElement.selectAll('tile').data(function(d) {
            return d.values;
        }).enter().append('path').attr('class', 'tile').attr('d', d3.svg.arc().innerRadius(conf.innerRadius).outerRadius(conf.outerRadius).startAngle(function(d, i) {
            return utils.theta(d.start, layout.blocks[d.block_id]);
        }).endAngle(function(d, i) {
Severity: Major
Found in public/packages/circosJS@1.7.0.js and 1 other location - About 4 hrs to fix
public/packages/circosJS@1.7.0.js on lines 675..683

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

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

circosJS.Chord = function() {
    circosJS.Track.call(this);
    this.parseData = circosJS.parseChordData;
    this.applyRules = function(rules, data) {
        var datum, l, len, results, rule;
Severity: Major
Found in public/packages/circosJS@1.7.0.js - About 4 hrs to fix

    Function setupTooltip has 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        setupTooltip() {
            var selected = {};
            $('.circos-distribution').on(
                'click',
                _.bind(function (event) {
    Severity: Major
    Found in public/js/circos.js - About 4 hrs to fix

      Function updateState has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          updateState() {
              var results = [];
              var numHSPsProcessed = 0;
              while (this.nextQuery < this.state.queries.length) {
                  var query = this.state.queries[this.nextQuery];
      Severity: Minor
      Found in public/js/report.js - About 3 hrs 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 get_styles has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

      var get_styles = function () {
          var styles = '';
      
          for (var i = 0; i < document.styleSheets.length; i++) {
              (function process_ss(ss) {
      Severity: Minor
      Found in public/js/svgExporter.js - About 3 hrs 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 Grapher has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function Grapher(Graph) {
          return class extends React.Component {
              constructor(props) {
                  super(props);
                  this.name = Graph.name();
      Severity: Major
      Found in public/js/grapher.js - About 3 hrs to fix

        Function updateState has 81 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            updateState() {
                var results = [];
                var numHSPsProcessed = 0;
                while (this.nextQuery < this.state.queries.length) {
                    var query = this.state.queries[this.nextQuery];
        Severity: Major
        Found in public/js/report.js - About 3 hrs to fix

          Method has too many lines. [28/15]
          Open

              def defaults
                @defaults ||= {
                  host: '0.0.0.0',
                  port: 4567,
                  databases_widget: 'classic',
          Severity: Minor
          Found in lib/sequenceserver/config.rb by rubocop

          This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

          You can set literals you want to fold with CountAsOne. Available are: 'array', 'hash', and 'heredoc'. Each literal will be counted as one line regardless of its actual size.

          NOTE: The ExcludedMethods configuration is deprecated and only kept for backwards compatibility. Please use IgnoredMethods instead.

          Example: CountAsOne: ['array', 'heredoc']

          def m
            array = [       # +1
              1,
              2
            ]
          
            hash = {        # +3
              key: 'value'
            }
          
            <<~HEREDOC      # +1
              Heredoc
              content.
            HEREDOC
          end               # 5 points

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

                  }).attr('d', d3.svg.arc().innerRadius(function(d) {
                      var height;
                      if (conf.direction === 'in') {
                          height = utils.ratio(d.value, conf.cmin, conf.cmax, conf.outerRadius - conf.innerRadius, false, conf.logscale);
                          return conf.outerRadius - height;
          Severity: Major
          Found in public/packages/circosJS@1.7.0.js and 1 other location - About 3 hrs to fix
          public/packages/circosJS@1.7.0.js on lines 735..751

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

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

              graphControls($queryDiv, $graphDiv, isInit, opts, hits) {
                  var MIN_HITS_TO_SHOW = 20;
          
                  var totalHits, shownHits, lessButton, moreButton;
          
          
          Severity: Major
          Found in public/js/hits_overview.js - About 3 hrs to fix

            Function renderLayoutTicks has 74 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            circosJS.renderLayoutTicks = function(conf, layout, d3, instance) {
                var blockTicks, displayLabel, ticks;
                blockTicks = function(d) {
                    var k,space;
                    k = (d.end - d.start) / d.len;
            Severity: Major
            Found in public/packages/circosJS@1.7.0.js - About 2 hrs to fix

              Function componentDidMount has 72 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  componentDidMount() {
                      var self = this;
                      var FASTA_FORMAT = /^>/;
              
                      $(document).ready(function () {
              Severity: Major
              Found in public/js/dnd.js - About 2 hrs to fix

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

                    this.renderDatumContainer = (function(_this) {
                        return function(instance, parentElement, name, data, conf) {
                            var group, track;
                            track = parentElement.append('g').attr('class', conf.colorPalette);
                            return group = _this.renderBlock(track, data, instance._layout, conf);
                Severity: Major
                Found in public/packages/circosJS@1.7.0.js and 1 other location - About 2 hrs to fix
                public/packages/circosJS@1.7.0.js on lines 967..973

                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

                    this.renderDatumContainer = (function(_this) {
                        return function(instance, parentElement, name, data, conf) {
                            var group, track;
                            track = parentElement.append('g').attr('class', conf.colorPalette);
                            return group = _this.renderBlock(track, data, instance._layout, conf);
                Severity: Major
                Found in public/packages/circosJS@1.7.0.js and 1 other location - About 2 hrs to fix
                public/packages/circosJS@1.7.0.js on lines 667..673

                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

                Function downloadsPanelJSX has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    downloadsPanelJSX() {
                        return (
                            <div className="downloads">
                                <div className="section-header-sidebar">
                                    <h4>
                Severity: Major
                Found in public/js/sidebar.js - About 2 hrs to fix

                  Method has too many lines. [25/15]
                  Open

                      def _make_blast_database(file, type, title, taxonomy)
                        cmd = "makeblastdb -parse_seqids -hash_index -in '#{file}'" \
                              " -dbtype #{type.to_s.slice(0, 4)} -title '#{title}'" \
                              " #{taxonomy}"
                  
                  
                  Severity: Minor
                  Found in lib/sequenceserver/makeblastdb.rb by rubocop

                  This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                  You can set literals you want to fold with CountAsOne. Available are: 'array', 'hash', and 'heredoc'. Each literal will be counted as one line regardless of its actual size.

                  NOTE: The ExcludedMethods configuration is deprecated and only kept for backwards compatibility. Please use IgnoredMethods instead.

                  Example: CountAsOne: ['array', 'heredoc']

                  def m
                    array = [       # +1
                      1,
                      2
                    ]
                  
                    hash = {        # +3
                      key: 'value'
                    }
                  
                    <<~HEREDOC      # +1
                      Heredoc
                      content.
                    HEREDOC
                  end               # 5 points

                  Method has too many lines. [25/15]
                  Open

                    def self.sys(command, options = {})
                      # Available output channels
                      channels = %i[stdout stderr]
                  
                      # Make temporary files to store output from stdout and stderr.
                  Severity: Minor
                  Found in lib/sequenceserver/sys.rb by rubocop

                  This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                  You can set literals you want to fold with CountAsOne. Available are: 'array', 'hash', and 'heredoc'. Each literal will be counted as one line regardless of its actual size.

                  NOTE: The ExcludedMethods configuration is deprecated and only kept for backwards compatibility. Please use IgnoredMethods instead.

                  Example: CountAsOne: ['array', 'heredoc']

                  def m
                    array = [       # +1
                      1,
                      2
                    ]
                  
                    hash = {        # +3
                      key: 'value'
                    }
                  
                    <<~HEREDOC      # +1
                      Heredoc
                      content.
                    HEREDOC
                  end               # 5 points

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

                                  if (_.indexOf(this.chordsHide, index) == -1) {
                                      var slen = obj[1] + obj[2];
                                      var tlen = obj[4] + obj[5];
                                      $('#' + obj[0] + '_' + slen + '_' + obj[3] + '_' + tlen).hide();
                                  }
                  Severity: Major
                  Found in public/js/circos.js and 1 other location - About 2 hrs to fix
                  public/js/circos.js on lines 427..431

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

                  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