rletters/rletters

View on GitHub

Showing 80 of 114 total issues

File color_brewer.rb has 546 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module RLetters
  module Visualization
    # Color ramps from the ColorBrewer color palettes
    #
    # These are drawn from ColorBrewer, www.ColorBrewer.org, by Cynthia A.
Severity: Major
Found in app/lib/r_letters/visualization/color_brewer.rb - About 1 day to fix

    Method to_mods has 134 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def to_mods(doc, include_namespace = true)
              xml_doc = Nokogiri::XML::Document.new
              mods = Nokogiri::XML::Node.new('mods', xml_doc)
              xml_doc.add_child(mods)
    
    
    Severity: Major
    Found in app/lib/r_letters/documents/serializers/mods.rb - About 5 hrs to fix

      Method to_marc_record has 108 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def to_marc_record(doc)
                record = ::MARC::Record.new
      
                record.append(::MARC::ControlField.new('001', doc.uid))
                record.append(::MARC::ControlField.new('003', 'RLID'))
      Severity: Major
      Found in app/lib/r_letters/documents/serializers/marc_record.rb - About 4 hrs to fix

        Method to_marc_record has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

                def to_marc_record(doc)
                  record = ::MARC::Record.new
        
                  record.append(::MARC::ControlField.new('001', doc.uid))
                  record.append(::MARC::ControlField.new('003', 'RLID'))
        Severity: Minor
        Found in app/lib/r_letters/documents/serializers/marc_record.rb - About 4 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 100 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def perform(user)
            raise 'Attempted to export a non-user object' unless user.is_a?(User)
        
            # Kill any already attached file
            user.export_archive.purge if user.export_archive.attached?
        Severity: Major
        Found in app/jobs/user_export_job.rb - About 4 hrs to fix

          Method perform has 98 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def perform(task, options = {})
              standard_options(task, options)
          
              # Patch up the two strange arguments that don't come in the right format
              # from the web form
          Severity: Major
          Found in app/jobs/word_frequency_job.rb - About 3 hrs to fix

            Method call has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

                  def call
                    case scoring
                    when :log_likelihood
                      score_class = Scoring::LogLikelihood
                    when :mutual_information
            Severity: Minor
            Found in app/lib/r_letters/analysis/cooccurrence.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 group_corpus has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                  def group_corpus
                    ret = {}
                    start = 0
            
                    num_docs = 0
            Severity: Minor
            Found in app/lib/r_letters/analysis/count_articles_by_field.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

            Function createNetworkGraph has 84 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function createNetworkGraph() {
              // Get the elements we need
              var graphContainer = window.jQuery('.network_graph');
              if (graphContainer.length === 0)
                return;
            Severity: Major
            Found in app/assets/javascripts/jobs/network.js - About 3 hrs to fix

              Method validate! has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                    def validate!
                      if query.present?
                        # Construct field and value from the query
                        parts = query.split(':')
                        unless parts.size == 2
              Severity: Minor
              Found in app/lib/r_letters/solr/facet.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 year_ranges_query has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                    private_class_method def self.year_ranges_query(year_ranges)
                      # Strip whitespace, split on commas
                      ranges = year_ranges.gsub(/\s/, '').split(',')
                      year_queries = []
              
              
              Severity: Minor
              Found in app/lib/r_letters/solr/advanced.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 frequencies has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                    def frequencies
                      analyzer = Frequency.call(
                        dataset: dataset,
                        stemming: stemming,
                        block_size: window,
              Severity: Minor
              Found in app/lib/r_letters/analysis/cooccurrence.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 grouped_uids_corpus has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                    def grouped_uids_corpus
                      ret = {}
                      start = 0
              
                      num_docs = 0
              Severity: Minor
              Found in app/lib/r_letters/analysis/count_terms_by_field.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 perform has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def perform(task, options)
                  standard_options(task, options)
              
                  unless datasets.size == 2
                    raise ArgumentError, 'Wrong number of other datasets provided'
              Severity: Major
              Found in app/jobs/craig_zeta_job.rb - About 2 hrs to fix

                Method journal_list has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    def journal_list
                      ret = []
                      offset = 0
                
                      loop do
                Severity: Minor
                Found in app/controllers/admin/categories_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 to_mods has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                        def to_mods(doc, include_namespace = true)
                          xml_doc = Nokogiri::XML::Document.new
                          mods = Nokogiri::XML::Node.new('mods', xml_doc)
                          xml_doc.add_child(mods)
                
                
                Severity: Minor
                Found in app/lib/r_letters/documents/serializers/mods.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 for has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                      def self.for(lang)
                        filename = Rails.root.join('app', 'lib', 'r_letters', 'analysis',
                                                   'stop_list', "stopwords_#{lang}.txt")
                        return nil unless File.exist?(filename)
                
                
                Severity: Minor
                Found in app/lib/r_letters/analysis/stop_list.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 perform has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def perform(task, options = {})
                    standard_options(task, options)
                
                    # Get the counts
                    result = RLetters::Analysis::CountArticlesByField.call(
                Severity: Major
                Found in app/jobs/article_dates_job.rb - About 2 hrs to fix

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

                        private_class_method def self.parse_search(params)
                          {}.tap do |ret|
                            # Advanced search support
                            if params[:advanced]
                              q_array = []
                  Severity: Minor
                  Found in app/lib/r_letters/solr/search.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 call has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def call
                          case scoring
                          when :log_likelihood
                            score_class = Scoring::LogLikelihood
                          when :mutual_information
                  Severity: Major
                  Found in app/lib/r_letters/analysis/cooccurrence.rb - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language