wurmlab/sequenceserver

View on GitHub

Showing 16,957 of 16,957 total issues

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

        _.each(
            this.new_layout,
            _.bind(function (obj) {
                var id = obj.id.slice(0, 3);
                if (id == 'Que') {
Severity: Major
Found in public/js/circos.js and 1 other location - About 2 hrs to fix
public/js/circos.js on lines 171..179

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

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

    Object.assign = function(target) {
        'use strict';
        var index, key, source;
        if (target === null) {
            throw new TypeError('Cannot convert undefined or null to object');
Severity: Minor
Found in public/js/circosjs.js - About 2 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 render has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

circosJS.Core.prototype.render = function(ids, removeTracks) {
    var name, ref, ref1, renderAll, svg, track, trackStore, trackType, tracks, translated;
    if (typeof ids === 'undefined') {
        renderAll = true;
        ids = [];
Severity: Minor
Found in public/js/circosjs.js - About 2 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 exports has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = (env, argv)  => {
    const pluginsPath = env.pluginsPath || './public/js/null_plugins';

    return {
        entry: {
Severity: Major
Found in webpack.config.js - About 2 hrs to fix

    Function ribbonV3 has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var ribbonV3 = function() {
        var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
        function chord(d, i) {
            var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
            result = "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.p0) : curve(t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(s.p0)) + "Z";
    Severity: Major
    Found in public/js/circosjs.js - About 2 hrs to fix

      Function smartBorders has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      circosJS.Core.prototype.smartBorders = function() {
          var border, borders, currentBorder, l, layout, len, ref, store, track, trackId, trackType, width;
          width = this.conf.defaultTrackWidth;
          layout = {
              'in': this._layout.conf.innerRadius,
      Severity: Major
      Found in public/js/circosjs.js - About 2 hrs to fix

        Function parseChordData has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        circosJS.parseChordData = function(data, layoutSummary) {
            var sample;
            sample = data[0];
            if ('source_id' in sample && 'source_start' in sample && 'source_end' && 'target_id' in sample && 'target_start' in sample && 'target_end' in sample) {
                data = data.map(function(datum) {
        Severity: Major
        Found in public/js/circosjs.js - About 2 hrs to fix

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

                def raise!
                  return true if exitstatus.zero? && !File.zero?(stdout)
          
                  case exitstatus
                  when 1..2
          Severity: Minor
          Found in lib/sequenceserver/blast/error.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

            const getNsseq = () => {
              switch (props.algorithm) {
                case "blastp":
                case "blastx":
                case "tblastn":
          Severity: Major
          Found in public/js/hsp.js and 1 other location - About 2 hrs to fix
          public/js/hsp.js on lines 218..231

          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

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

                              $('<button/>')
                                  .addClass('btn btn-link text-sm text-seqblue hover:text-seqorange cursor-pointer more')
                                  .attr('type', 'button')
                                  .attr('data-parent-query', $queryDiv.attr('id'))
                                  .html('View More&nbsp;')
          Severity: Major
          Found in public/js/hits_overview.js and 1 other location - About 2 hrs to fix
          public/js/hits_overview.js on lines 92..101

          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

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

            const getNqseq = () => {
              switch (props.algorithm) {
                case "blastp":
                case "blastx":
                case "tblastn":
          Severity: Major
          Found in public/js/hsp.js and 1 other location - About 2 hrs to fix
          public/js/hsp.js on lines 237..250

          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

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

                              $('<button/>')
                                  .addClass('btn btn-link text-sm text-seqblue hover:text-seqorange cursor-pointer less')
                                  .attr('type', 'button')
                                  .attr('data-parent-query', $queryDiv.attr('id'))
                                  .html('View Less&nbsp;')
          Severity: Major
          Found in public/js/hits_overview.js and 1 other location - About 2 hrs to fix
          public/js/hits_overview.js on lines 82..91

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

              draw_axes() {
                  var space, len;
                  len = this._scale_y.ticks().length;
                  if (len >= 5) {
                      space = 5;
          Severity: Minor
          Found in public/js/length_distribution.js - About 1 hr to fix

            Function _render_polygons has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _render_polygons() {
                    var self = this;
            
                    // Remove all existing child elements.
                    this._svg.d3.selectAll('*').remove();
            Severity: Minor
            Found in public/js/kablammo.js - About 1 hr to fix

              Function hspLines has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const hspLines = () => {
                  // Space reserved for showing coordinates
                  const width = hspLinesWidth();
              
                  // Number of residues we can draw per line is the total number of
              Severity: Minor
              Found in public/js/hsp.js - About 1 hr to fix

                Function renderDatabases has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    renderDatabases(category) {
                    // Panel name and column width.
                        var panelTitle = category[0].toUpperCase() + category.substring(1).toLowerCase() + ' databases';
                        var columnClass = this.categories().length === 1 ? 'col-span-2' : '';
                
                
                Severity: Minor
                Found in public/js/databases.js - About 1 hr to fix

                  Block has too many lines. [44/25]
                  Open

                      post '/cloud_share' do
                        content_type :json
                        request_params = JSON.parse(request.body.read)
                        job = Job.fetch(request_params['job_id'])
                        halt 404, { error: 'Job not found' }.to_json if job.nil?
                  Severity: Minor
                  Found in lib/sequenceserver/routes.rb by rubocop

                  This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

                  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']

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

                  NOTE: This cop does not apply for Struct definitions.

                  Perceived complexity for spawn_cleanup is too high. [10/8]
                  Open

                      def spawn_cleanup
                        Thread.new do
                          loop do
                            now = Time.now
                            finished_jobs = Job.all.select(&:done?)
                  Severity: Minor
                  Found in lib/sequenceserver/job_remover.rb by rubocop

                  This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

                  Example:

                  def my_method                   # 1
                    if cond                       # 1
                      case var                    # 2 (0.8 + 4 * 0.2, rounded)
                      when 1 then func_one
                      when 2 then func_two
                      when 3 then func_three
                      when 4..10 then func_other
                      end
                    else                          # 1
                      do_something until a && b   # 2
                    end                           # ===
                  end                             # 7 complexity points

                  Cyclomatic complexity for spawn_cleanup is too high. [9/7]
                  Open

                      def spawn_cleanup
                        Thread.new do
                          loop do
                            now = Time.now
                            finished_jobs = Job.all.select(&:done?)
                  Severity: Minor
                  Found in lib/sequenceserver/job_remover.rb by rubocop

                  This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

                  An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one. Blocks that are calls to builtin iteration methods (e.g. `ary.map{...}) also add one, others are ignored.

                  def each_child_node(*types)               # count begins: 1
                    unless block_given?                     # unless: +1
                      return to_enum(__method__, *types)
                  
                    children.each do |child|                # each{}: +1
                      next unless child.is_a?(Node)         # unless: +1
                  
                      yield child if types.empty? ||        # if: +1, ||: +1
                                     types.include?(child.type)
                    end
                  
                    self
                  end                                       # total: 6

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

                    renderForm() {
                      const { email, agreeToTos } = this.state;
                      const isSubmitDisabled = !agreeToTos;
                  
                      return(
                  Severity: Minor
                  Found in public/js/cloud_share_modal.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language