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.chords_arr, function (obj) {
            var slen = obj[1] + obj[2];
            var tlen = obj[4] + obj[5];
            $('#' + obj[0] + '_' + slen + '_' + obj[3] + '_' + tlen).show();
        });
Severity: Major
Found in public/js/circos.js and 1 other location - About 2 hrs to fix
public/js/circos.js on lines 453..457

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

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 422..426

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

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

        svg_legend.append('text')
            .attr('class',' legend-text')
            .attr('transform', 'translate(0, ' + options.legend + ')')
            .attr('x', 6.7 * (width - 2 * options.margin) / 10 - options.margin / 2)
            .text('Stronger hits');
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 171..175

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

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

        svg_legend.append('text')
            .attr('class',' legend-text')
            .attr('transform', 'translate(0, ' +options.legend +')')
            .attr('x', 9.5 * (width - 2 * options.margin) / 10 + options.margin / 2)
            .text('Weaker hits');
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 180..184

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

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 has too many lines. [22/15]
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 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. [22/15]
Open

      def initialize(params)
        if params.key?(:xml)
          super do
            @imported_xml_file = File.basename params[:xml]
            # Copy over the XML file to job directory so that a job dir in
Severity: Minor
Found in lib/sequenceserver/blast/job.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

Function removeTracks has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

circosJS.Core.prototype.removeTracks = function(trackIds) {
    var id, l, len, ref, store, svg, trackId, type;
    svg = d3.select(this.conf.container);
    ref = this.tracks;
    for (type in ref) {
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 drawLegend has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    drawLegend() {
        this.ratioHSP = [];
        _.each(
            this.chords_arr,
            _.bind(function (obj) {
Severity: Major
Found in public/js/circos.js - About 2 hrs to fix

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

                <div className="flex items-start justify-between rounded-t border-b p-5">
                  <h3 className="text-xl font-medium text-gray-900">
                    Share to SequenceServer Cloud
                  </h3>
                  <button className="ml-auto inline-flex items-center rounded-lg bg-transparent p-1.5 text-sm text-gray-400 hover:bg-gray-200" onClick={this.hide}>
    Severity: Major
    Found in public/js/cloud_share_modal.js and 1 other location - About 2 hrs to fix
    public/js/sequence_modal.js on lines 30..37

    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

                <div className="flex items-start justify-between rounded-t border-b p-5">
                  <h3 className="text-xl font-medium text-gray-900">
                    View sequence
                  </h3>
                  <button className="sequence-viewer-close ml-auto inline-flex items-center rounded-lg bg-transparent p-1.5 text-gray-400 hover:bg-gray-200" onClick={this.hide}>
    Severity: Major
    Found in public/js/sequence_modal.js and 1 other location - About 2 hrs to fix
    public/js/cloud_share_modal.js on lines 197..204

    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

    Function pollPeriodically has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        pollPeriodically(path, callback, errCallback) {
        var intervals = [200, 400, 800, 1200, 2000, 3000, 5000];
            function poll() {
                fetch(path)
                    .then(response => {
    Severity: Major
    Found in public/js/report.js - About 2 hrs to fix

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

          def convert_deprecated_options(options)
            options.each do |blast_algo, algo_config|
              if algo_config.is_a?(Array)
                # Very old config files may have a single array with CLI args.
                # e.g. { blastn: ['-task blastn', '-evalue 1e-5'] }
      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

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

      def ask_to_join
        asked_to_join = File.join(SequenceServer::DOTDIR, 'asked_to_join')
        unless File.exist?(asked_to_join)
          puts
          puts <<~MSG
      Severity: Minor
      Found in bin/sequenceserver 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

      Function Layout has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      circosJS.Layout = function(conf, data) {
          var block_nb, gap, k, offset, ref, ref1, size, v;
          if (data == null) {
              circosJS.log(2, 'no layout data', '');
          }
      Severity: Major
      Found in public/js/circosjs.js - About 2 hrs to fix

        Line is too long. [142/120]
        Open

                      if xml_ir.size < 9 || !xml_ir[0].is_a?(String) || !xml_ir[1].is_a?(String) || !xml_ir[7].is_a?(Array) || !xml_ir[8].is_a?(Array)
        Severity: Minor
        Found in lib/sequenceserver/blast/report.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/IndentationStyle cop. It also ignores a shebang line by default.

        This cop has some autocorrection capabilities. It can programmatically shorten certain long lines by inserting line breaks into expressions that can be safely split across lines. These include arrays, hashes, and method calls with argument lists.

        If autocorrection is enabled, the following Layout cops are recommended to further format the broken lines. (Many of these are enabled by default.)

        • ArgumentAlignment
        • BlockAlignment
        • BlockDelimiters
        • BlockEndNewline
        • ClosingParenthesisIndentation
        • FirstArgumentIndentation
        • FirstArrayElementIndentation
        • FirstHashElementIndentation
        • FirstParameterIndentation
        • HashAlignment
        • IndentationWidth
        • MultilineArrayLineBreaks
        • MultilineBlockLayout
        • MultilineHashBraceLayout
        • MultilineHashKeyLineBreaks
        • MultilineMethodArgumentLineBreaks
        • ParameterAlignment

        Together, these cops will pretty print hashes, arrays, method calls, etc. For example, let's say the max columns is 25:

        Example:

        # bad
        {foo: "0000000000", bar: "0000000000", baz: "0000000000"}
        
        # good
        {foo: "0000000000",
        bar: "0000000000", baz: "0000000000"}
        
        # good (with recommended cops enabled)
        {
          foo: "0000000000",
          bar: "0000000000",
          baz: "0000000000",
        }

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

              def tree
                all.each_with_object({}) do |db, data|
                  data[db.type] ||= []
                  use_parent = '#'
                  db.categories.each_with_index do |entry, index|
        Severity: Minor
        Found in lib/sequenceserver/database.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. [19/15]
        Open

              def validate
                ids = Database.ids
                unless database_ids.is_a?(Array) &&
                       !database_ids.empty? &&
                       (ids & database_ids).length == database_ids.length
        Severity: Minor
        Found in lib/sequenceserver/sequence.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

        Function renderDatabases has 53 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: Major
        Found in public/js/databases_tree.js - About 2 hrs to fix

          Function hspStats has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const hspStats = () => {
              // An array to hold text or span elements that make up the line.
              let line = [];
          
              // Bit score and total score.
          Severity: Major
          Found in public/js/hsp.js - About 2 hrs to fix

            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 == 'Hit') {
            Severity: Major
            Found in public/js/circos.js and 1 other location - About 2 hrs to fix
            public/js/circos.js on lines 162..170

            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

            Severity
            Category
            Status
            Source
            Language