Showing 4,033 of 4,033 total issues

Method do_work has a Cognitive Complexity of 129 (exceeds 5 allowed). Consider refactoring.
Open

  def do_work(args = nil)
    # start from scratch
    @last_id = nil
    @done = false
    @record_count = 0
Severity: Minor
Found in lib/workers/zoom_index_rebuild_worker.rb - About 2 days 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

Class has too many lines. [293/100]
Open

class PqfQuery
  # relevance attribute spec says, in essence
  # sort by dynamic relevance ranking (based on query)
  # and match partial words (truncated on either the left or right, i.e. both)
  # and do fuzzy matching (any one character in term may be replaced to match in search)
Severity: Minor
Found in app/models/pqf_query.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for do_work is too high. [167.7/15]
Open

  def do_work(args = nil)
    # start from scratch
    @last_id = nil
    @done = false
    @record_count = 0

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [160/10]
Open

  def do_work(args = nil)
    # start from scratch
    @last_id = nil
    @done = false
    @record_count = 0

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Module has too many lines. [285/100]
Open

    module VersioningAndModeration
      def test_responds_to_private_and_is_set_properly_with_private_false
        doc = eval(@base_class).create(@new_model.merge({ private: false }))
        assert_equal false, doc.private?
      end
Severity: Minor
Found in lib/item_privacy_test_helper.rb by rubocop

This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [154/10]
Open

  def create_new_item_from_record(record, zoom_class, options = {})
    zoom_class_for_params = zoom_class.tableize.singularize

    params = options[:params]

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Module has too many lines. [251/100]
Open

  module Defaults
    # RABID:
    #
    # Defaults, mostly taken from the system_setting table on an existing
    # Kete2 system's database.
Severity: Minor
Found in app/models/system_setting.rb by rubocop

This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for importer_prepare_extended_field is too high. [147.1/15]
Open

    def importer_prepare_extended_field(options = {})
      params = options[:params]
      field = options[:field]
      value = options[:value]
      zoom_class_for_params = options[:zoom_class_for_params]
Severity: Minor
Found in lib/importer.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Class has too many lines. [245/100]
Open

class MembersController < ApplicationController
  permit 'site_admin or admin of :current_basket', except: %i[index list join remove rss]

  before_filter :permitted_to_view_memberlist, only: %i[index list rss]

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [244/100]
Open

class ConfigureController < ApplicationController
  # everything else is handled by application.rb
  before_filter :login_required, only: %i[
    section finish
    done_with_settings zoom_dbs_edit

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method create_new_item_from_record has a Cognitive Complexity of 103 (exceeds 5 allowed). Consider refactoring.
Open

    def create_new_item_from_record(record, zoom_class, options = {})
      zoom_class_for_params = zoom_class.tableize.singularize

      params = options[:params]

Severity: Minor
Found in lib/importer.rb - About 2 days 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

Assignment Branch Condition size for importer_process is too high. [139.6/15]
Open

  def importer_process(record, params)
    current_record = @results[:records_processed] + 1
    logger.info("starting record #{current_record}")

    # clear this out so last related_topic

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method extended_content_field_xml_tag has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring.
Open

    def extended_content_field_xml_tag(options = {})
      xml = options[:xml]
      field = options[:field]
      value = options[:value] || nil
      xml_element_name = options[:xml_element_name] || nil
Severity: Minor
Found in lib/extended_content_helpers.rb - About 2 days 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 has too many lines. [132/10]
Open

    def create_new_item_from_record(record, zoom_class, options = {})
      zoom_class_for_params = zoom_class.tableize.singularize

      params = options[:params]

Severity: Minor
Found in lib/importer.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for included is too high. [135.2/15]
Open

    def self.included(base)
      base.class_eval do
        if base.name == 'IndexPageControllerTest'
          context 'The index page' do
            setup do
Severity: Minor
Found in lib/image_slideshow_test_helper.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Module has too many lines. [225/100]
Open

module Flagging
  unless included_modules.include? Flagging
    attr_accessor :do_not_moderate
    attr_accessor :pending_version

Severity: Minor
Found in lib/flagging.rb by rubocop

This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

File importer.rb has 806 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'tempfile'
require 'fileutils'
require 'mime/types'
require 'oai_dc_helpers'
require 'xml_helpers'
Severity: Major
Found in lib/importer.rb - About 1 day to fix

    Module has too many lines. [220/100]
    Open

    module OaiDcHelpers
      unless included_modules.include? OaiDcHelpers
        def self.included(klass)
          klass.send :include, XmlHelpers
        end
    Severity: Minor
    Found in lib/oai_dc_helpers.rb by rubocop

    This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method records_pre_processor has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring.
    Open

      def records_pre_processor
        path_to_records_file_output = @import_dir_path + '/records.xml'
        path_to_dfc_xml_file = @import_dir_path + '/records.dfc.xml'
        path_to_dfc_convertor_log = @import_dir_path + '/convert.log'
    
    
    Severity: Minor
    Found in lib/workers/dfc_xml_importer_worker.rb - About 1 day 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

    Class has too many lines. [216/100]
    Open

    class User < ActiveRecord::Base
      # imports are processes to bring in content to a basket
      # they specify a topic type of thing they are importing
      # or a topic type for the item that relates groups of things
      # that they are importing
    Severity: Minor
    Found in app/models/user.rb by rubocop

    This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Severity
    Category
    Status
    Source
    Language