openSNP/snpr

View on GitHub

Showing 49 of 71 total issues

Method show has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    def show
        @user = User.find_by_id(params[:id])
        @genotype = @user.genotypes.first

        # make arrays of positions and ids in case we have several
Severity: Minor
Found in app/controllers/das_controller.rb - About 5 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 perform has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

  def perform(genotype_id)
    genotype = Genotype.find(genotype_id)

    logger.info "Starting preparse"
    biggest = ''
Severity: Minor
Found in app/workers/preparsing.rb - About 5 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 perform has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perform(genotype_id)
    genotype = Genotype.find(genotype_id)

    logger.info "Starting preparse"
    biggest = ''
Severity: Major
Found in app/workers/preparsing.rb - About 4 hrs to fix

    Method show has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def show
            @user = User.find_by_id(params[:id])
            @genotype = @user.genotypes.first
    
            # make arrays of positions and ids in case we have several
    Severity: Major
    Found in app/controllers/das_controller.rb - About 2 hrs to fix

      Method make_annotation has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def make_annotation(result, snp, name)
          # TODO: Refactor this. - Helge
          result[name] = {}
          result[name]['name'] = snp.name
          result[name]['chromosome'] = snp.chromosome
      Severity: Major
      Found in app/controllers/snps_controller.rb - About 2 hrs to fix

        Method perform has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          def perform(snp_id)
            Snp.reset_counters(snp_id, :user_snps)
            s = Snp.find(snp_id)
            s.allele_frequency ||= { "A" => 0, "T" => 0, "G" => 0, "C" => 0}
            s.genotype_frequency ||= {}
        Severity: Minor
        Found in app/workers/frequency.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

        Function snpApp has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var snpApp = function () {
              var $searchButton = $('[data-js="search-button"]');
              var $searchForm = $('[data-js="search-form"]');
              var $panelHeader = $('[data-js="panel-header"]');
              var $extendButton = $('[data-js="extend-button"]');
        Severity: Major
        Found in app/assets/javascripts/script.js - About 2 hrs to fix

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

            def perform_search
              # return an array of page-titles
              pages = client.list("#{snp.name}(")
              snpedia_updated = false
              (pages || []).each do |page|
          Severity: Minor
          Found in app/workers/snpedia.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

          Method create has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              @phenotype_comment = PhenotypeComment.new(phenotype_comment_params)
              if @phenotype_comment.comment_text.index(/\A(\@\#\d*\:)/) == nil
                @phenotype_comment.reply_to_id = -1
              else
          Severity: Minor
          Found in app/controllers/phenotype_comments_controller.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

          Method create has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              @snp_comment = SnpComment.new(comment_params)
              if @snp_comment.comment_text.index(/\A(\@\#\d*\:)/) == nil
                @snp_comment.reply_to_id = -1
              else
          Severity: Minor
          Found in app/controllers/snp_comments_controller.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

          Method create has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              @phenotype_comment = PicturePhenotypeComment.new(picture_phenotype_comment_params)
              if @phenotype_comment.comment_text.index(/\A(\@\#\d*\:)/) == nil
                @phenotype_comment.reply_to_id = -1
              else
          Severity: Minor
          Found in app/controllers/picture_phenotype_comments_controller.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

          Method process_documents has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            def process_documents(documents)
              if documents.blank?
                logger.info("mendeley: No papers found")
                return
              end
          Severity: Minor
          Found in app/workers/mendeley_search.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 perform has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def perform()
              puts "Running PgpAnnotationJob\n"
              known_snps = {}
              Snp.find_each do |s| known_snps[s.name] = true end
          
          
          Severity: Minor
          Found in app/workers/pgpannotation.rb - About 1 hr to fix

            Method create has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def create
                unless @phenotype = PicturePhenotype.find_by_characteristic(params[:picture_phenotype][:characteristic])
                  puts params[:picture_phenotype]
                  @phenotype = PicturePhenotype.create(picture_phenotype_params)
            
            
            Severity: Minor
            Found in app/controllers/picture_phenotypes_controller.rb - About 1 hr to fix

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

                def update
                  @user = User.find(params[:id])
              
                  if params[:user][:user_phenotypes_attributes].present?
                    params[:user][:user_phenotypes_attributes].each do |p|
              Severity: Minor
              Found in app/controllers/users_controller.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 show has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def show
                  # showing a single user's page
                  @user = User.find_by_id(params[:id]) || not_found
                  @title = @user.name + '\'s page'
                  @first_name = @user.name.split.first
              Severity: Minor
              Found in app/controllers/users_controller.rb - About 1 hr to fix

                Method create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  def create
                    @user_phenotype = UserPhenotype.new(user_phenotype_params)
                    @user_phenotype.user_id = current_user.id
                
                    if params[:js_modal]
                Severity: Minor
                Found in app/controllers/user_phenotypes_controller.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 create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  def create
                    unless @phenotype = PicturePhenotype.find_by_characteristic(params[:picture_phenotype][:characteristic])
                      puts params[:picture_phenotype]
                      @phenotype = PicturePhenotype.create(picture_phenotype_params)
                
                
                Severity: Minor
                Found in app/controllers/picture_phenotypes_controller.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 create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  def create
                    @user_phenotype = current_user.user_picture_phenotypes.new(
                      phenotype_picture: params[:user_picture_phenotype][:phenotype_picture])
                    @user_phenotype.phenotype_picture = params[:user_picture_phenotype][:phenotype_picture]
                    @user_phenotype.user_id = current_user.id
                Severity: Minor
                Found in app/controllers/user_picture_phenotypes_controller.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 perform has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  def perform()
                    puts "Running PgpAnnotationJob\n"
                    known_snps = {}
                    Snp.find_each do |s| known_snps[s.name] = true end
                
                
                Severity: Minor
                Found in app/workers/pgpannotation.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

                Severity
                Category
                Status
                Source
                Language