Blahah/transrate

View on GitHub

Showing 34 of 34 total issues

Method check_reads has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def check_reads
    if @opts.left and @opts.right
      if @opts.left.split(",").length != @opts.right.split(",").length
        msg = "Please provide the same number of left reads as right reads"
        raise TransrateArgError.new msg
Severity: Minor
Found in lib/transrate/cmdline.rb - 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 print_missing_dependencies has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def print_missing_dependencies(missing, blast_missing)
    if missing.length + blast_missing.length > 0
      puts "Dependencies are missing:"

      missing.each do |dep|
Severity: Minor
Found in lib/transrate/cmdline.rb - About 1 hr to fix

    Method analyse_assembly has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def analyse_assembly(assembly, r, result_path)
        logger.info "Loading assembly: #{assembly}"
        a = Assembly.new assembly
    
        logger.info "Analysing assembly: #{assembly}"
    Severity: Minor
    Found in lib/transrate/cmdline.rb - About 1 hr to fix

      Method check_dependencies has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def check_dependencies
          # Check dependencies if they are relevant to the command issued,
          # and handle any commands to install missing ones
          gem_dir = Gem.loaded_specs['transrate'].full_gem_path
          gem_deps = File.join(gem_dir, 'deps', 'deps.yaml')
      Severity: Minor
      Found in lib/transrate/cmdline.rb - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def run assembly, bamfile, threads=8
            assembly = assembly.file if assembly.is_a? Assembly
            output = "quant.sf"
            sampled_bam = "postSample.bam"
            @fin_output = "#{File.basename assembly}_#{output}"
      Severity: Minor
      Found in lib/transrate/salmon.rb - About 55 mins 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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(assembly, reference, threads: 1)
            if assembly
              if assembly.is_a?(Assembly)
                @assembly = assembly
              else
      Severity: Minor
      Found in lib/transrate/transrater.rb - About 55 mins 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 classify_contigs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def classify_contigs cutoff
            # create hash of file handles for each output
            base = File.basename @file
            files = {}
            %w(good bad).each do |type|
      Severity: Minor
      Found in lib/transrate/assembly.rb - About 45 mins 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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize file
            @file = File.expand_path file
            unless File.exist? @file
              raise TransrateIOError.new "Assembly file doesn't exist: #{@file}"
            end
      Severity: Minor
      Found in lib/transrate/assembly.rb - About 45 mins 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 install_missing_dependencies has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def install_missing_dependencies(deps, read_deps, ref_deps,
                                         gem_deps, blast_dep)
      Severity: Minor
      Found in lib/transrate/cmdline.rb - About 35 mins to fix

        Method analyse_expression has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def analyse_expression salmon_output
              salmon_output.each_pair do |name, expr|
                contig_name = Bio::FastaDefline.new(name.to_s).entry_id
                contig_name.gsub!(/;$/, '') # trim trailing semicolon
                contig = @assembly[contig_name]
        Severity: Minor
        Found in lib/transrate/read_metrics.rb - About 35 mins 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 map_reads has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def map_reads(file, left, right, outputname: nil, threads: 8)
              raise SnapError.new("Index not built") if !@index_built
        
              lbase = File.basename(left.split(",").first)
              rbase = File.basename(right.split(",").first)
        Severity: Minor
        Found in lib/transrate/snap.rb - About 35 mins 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 load_expression has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def load_expression file
              expression = {}
              first = true
              File.open(file).each do |line|
                if first
        Severity: Minor
        Found in lib/transrate/salmon.rb - About 25 mins 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 check_assembly has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def check_assembly
            if @opts.assembly
              @opts[:assembly] = @opts.assembly.split(',').map do |a|
                File.expand_path a
              end.join(',')
        Severity: Minor
        Found in lib/transrate/cmdline.rb - About 25 mins 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 load_readcount has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def load_readcount reads
              @read_count = 0
              if File.exist?("#{@read_count_file}")
                @read_count = File.open("#{@read_count_file}").readlines.join.to_i
              else
        Severity: Minor
        Found in lib/transrate/snap.rb - About 25 mins 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