shyamrallapalli/cheripic

View on GitHub

Showing 23 of 23 total issues

Method argument_parser has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def argument_parser
      cmds = self
      Trollop::Parser.new do
        version Cheripic::VERSION
        banner cmds.help_message
Severity: Major
Found in lib/cheripic/cmd.rb - About 4 hrs to fix

    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

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

        def check_input_files(inputfiles)
          inputfiles.each_key do | type |
            inputfiles[type].flatten!
            check = 0
            inputfiles[type].each do | symbol |
    Severity: Minor
    Found in lib/cheripic/cmd.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

      Class Options has 22 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Options
      
          # Default parameter settings
          @def_settings = {
              :hmes_adjust => 0.5,
      Severity: Minor
      Found in lib/cheripic/options.rb - About 2 hrs to fix

        Method bulks_compared has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def bulks_compared
              @mut_bulk.each_key do | pos |
                ignore = 0
                unless @masked_regions.empty?
                  @masked_regions.each_key do | index |
        Severity: Minor
        Found in lib/cheripic/contig_pileups.rb - 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

        File cmd.rb has 260 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Cheripic
        
          # A command line option and processing object to handle input options
          #
          # @!attribute [rw] options
        Severity: Minor
        Found in lib/cheripic/cmd.rb - About 2 hrs to fix

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

              def self.get_bfr(mut_hash, bg_hash='')
                @bfr_adj = Options.bfr_adjust
                if bg_hash != ''
                  # checking if only two vars in base hash and that includes ref
                  # checking if only one var in hemi snp
          Severity: Minor
          Found in lib/cheripic/bfr.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 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 initialize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def initialize(inputs)
                set1 = %i{assembly
                          input_format
                          mut_bulk
                          bg_bulk
          Severity: Minor
          Found in lib/cheripic/implementer.rb - About 1 hr to fix

            Method check_input_files has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def check_input_files(inputfiles)
                  inputfiles.each_key do | type |
                    inputfiles[type].flatten!
                    check = 0
                    inputfiles[type].each do | symbol |
            Severity: Minor
            Found in lib/cheripic/cmd.rb - About 1 hr to fix

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

                    def self.get_vars(vcf_file)
                      ht_low = Options.htlow
                      ht_high = Options.hthigh
                
                      # hash of :het and :hom with frag ids and respective variant positions
                Severity: Minor
                Found in lib/cheripic/vcf.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 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 calculate_bfr has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def self.calculate_bfr(two_key_hash, other_hash)
                      # if :ref is absent such as below noise depth, then set to zero
                      unless two_key_hash.key?(:ref)
                        two_key_hash[:ref] = 0
                      end
                Severity: Minor
                Found in lib/cheripic/bfr.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 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 convert_boolean_strings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def convert_boolean_strings
                      %i{ambiguous_ref_bases use_all_contigs include_low_hmes polyploidy}.each do | symbol |
                        if @options.key?(symbol)
                          @options[symbol] = @options[symbol] == 'false' ? false : true
                        end
                Severity: Minor
                Found in lib/cheripic/cmd.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 hemisnps_in_parent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def hemisnps_in_parent
                      # mark all the hemi snp based on both parents
                      @mut_parent.each_key do |pos|
                        mut_parent_frac = @mut_parent[pos].var_base_frac
                        if @bg_parent.key?(pos)
                Severity: Minor
                Found in lib/cheripic/contig_pileups.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 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

                Severity
                Category
                Status
                Source
                Language