shyamrallapalli/cheripic

View on GitHub
lib/cheripic/variants.rb

Summary

Maintainability
C
1 day
Test Coverage

Method verify_bg_bulk_pileup has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def verify_bg_bulk_pileup
      unless defined?(@hmes_frags)
        self.hmes_frags
      end
      @hmes_frags.each_key do | frag |
Severity: Minor
Found in lib/cheripic/variants.rb - 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

File variants.rb has 283 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'bio'
require 'forwardable'

module Cheripic

Severity: Minor
Found in lib/cheripic/variants.rb - About 2 hrs to fix

    Method extract_bam_pileup has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def extract_bam_pileup(bamfile, sym)
          bq = Options.base_quality
          mq = Options.mapping_quality
          bamobject = Bio::DB::Sam.new(:bam=>bamfile, :fasta=>@params.assembly)
          bamobject.index unless bamobject.indexed?
    Severity: Minor
    Found in lib/cheripic/variants.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 set_max_depth has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def set_max_depth(bamobject, bamfile)
          logger.info "processing #{bamfile} file for depth"
          all_depths = []
          bq = Options.base_quality
          mq = Options.mapping_quality
    Severity: Minor
    Found in lib/cheripic/variants.rb - About 1 hr to fix

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

          def select_contigs(ratio_type)
            selected_contigs ={}
            use_all_contigs = Options.use_all_contigs
            @assembly.each_key do | frag |
              if use_all_contigs
      Severity: Minor
      Found in lib/cheripic/variants.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 compare_pileups has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def compare_pileups
            unless @pileups_analyzed
              self.analyse_pileups
            end
            @assembly.each_key do | id |
      Severity: Minor
      Found in lib/cheripic/variants.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 analyse_pileups has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def analyse_pileups
            if @params.input_format == 'bam'
              @vcf_hash = Vcf.filtering(@params.mut_bulk_vcf, @params.bg_bulk_vcf)
            end
            %i{mut_bulk bg_bulk mut_parent bg_parent}.each do | input |
      Severity: Minor
      Found in lib/cheripic/variants.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 extract_vcfs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def extract_vcfs(vcffile, sym)
            # read vcf file and process each variant
            File.foreach(vcffile) do |line|
              next if line =~ /^#/
              v = Bio::DB::Vcf.new(line)
      Severity: Minor
      Found in lib/cheripic/variants.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(options)
            @params = options
            @assembly = {}
            @pileups = {}
            Bio::FastaFormat.open(@params.assembly).each do |entry|
      Severity: Minor
      Found in lib/cheripic/variants.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 get_cutoff has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_cutoff(selected_contigs, ratio_type)
            include_low_hmes = Options.include_low_hmes
            # set minimum cut off hme_score or bfr_score to pick fragments with variants
            # calculate min hme score for back or out crossed data or bfr_score for polypoidy data
            # if no filtering applied set cutoff to 1.1
      Severity: Minor
      Found in lib/cheripic/variants.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

      There are no issues that match your filters.

      Category
      Status