Showing 4,033 of 4,033 total issues

Assignment Branch Condition size for populate_attributes_from_embedded_in is too high. [86.18/15]
Open

    def populate_attributes_from_embedded_in(file_path)
      # if there is no file we just leave it up to validation
      # to sort out what needs doing
      return unless File.exist?(file_path)

Severity: Minor
Found in lib/embedded.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. [127/100]
Open

module ImageSlideshow
  unless included_modules.include? ImageSlideshow
    def self.included(klass)
      if klass.name == 'TopicsController'
        klass.send :before_filter, :prepare_slideshow, only: ['selected_image']
Severity: Minor
Found in lib/image_slideshow.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.

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

module AuthenticatedSystem
  protected

  def deauthenticate
    current_user.forget_me if logged_in?
Severity: Minor
Found in lib/authenticated_system.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.

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

class ExcelPreProcessor < Nokogiri::XML::SAX::Document
  def initialize(path_to_xl_xml_file, options = {})
    # maybe TODO: refactor assignment from options
    # this fixes cut and paste error when code was moved to separate class
    # but ExcelPreProcessor may know too much about the calling environment

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

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

module ProfilesHelper
  # Override for ActiveScaffold rules column for basket profiles
  # Refer to http://activescaffold.com/docs/form-overrides for details
  # If a new record, for each form type, create a dropdown with the rule types
  # when the rule type is 'some', dropdown the rules selection settings
Severity: Minor
Found in app/helpers/profiles_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.

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

class ExtendedFieldsController < ApplicationController
  helper ExtendedFieldsHelper

  # everything else is handled by application.rb
  before_filter :login_required, only: %i[list index add_field_to_multiples fetch_subchoices fetch_topics_from_topic_type validate_topic_type_entry]

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 has too many lines. [78/10]
Open

    def populate_attributes_from_embedded_in(file_path)
      # if there is no file we just leave it up to validation
      # to sort out what needs doing
      return unless File.exist?(file_path)

Severity: Minor
Found in lib/embedded.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.

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

  def get_progress
    if !request.xhr?
      flash[:notice] = t('importers_controller.get_progress.import_failed')
      redirect_to action: 'list'
    else

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. [118/100]
Open

module ImageSlideshowTestHelper
  unless included_modules.include? ImageSlideshowTestHelper
    def self.included(base)
      base.class_eval do
        if base.name == 'IndexPageControllerTest'
Severity: Minor
Found in lib/image_slideshow_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.

Assignment Branch Condition size for test_new_private_item_with_moderated_basket is too high. [81.01/15]
Open

      def test_new_private_item_with_moderated_basket
        # Set up
        d = eval(@base_class).new(@new_model.merge({ description: 'Version 1', private: true }))
        d.instance_eval do
          def fully_moderated?
Severity: Minor
Found in lib/item_privacy_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

Method convert_extended_content_to_xml has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

    def convert_extended_content_to_xml(params_hash)
      return '' if params_hash.blank?

      builder = Nokogiri::XML::Builder.new
      builder.root do |xml|
Severity: Minor
Found in lib/extended_content.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

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

module RssHelper
  # ROB: Methods pulled from oai_dc_helpers.rb and simplified to return strings/nil
  # So far only used for StillImages. May need some more tweaking for other content-types.

  def rss_dc_identifier(item)
Severity: Minor
Found in app/helpers/rss_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.

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

class CommentsController < ApplicationController
  include ExtendedContentController

  def index
    redirect_to_search_for('Comment')

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

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

module ZoomControllerHelpers
  unless included_modules.include? ZoomControllerHelpers
    # set up our helper methods
    def self.included(klass)
      # only intended to add helper methods in app/controllers/application.rb
Severity: Minor
Found in lib/zoom_controller_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.

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

class Searcher
  def initialize(query: SearchQuery.new)
    @query = query
  end

Severity: Minor
Found in app/models/searcher.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.

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

module FieldMappingsController
  unless included_modules.include? FieldMappingsController

    def self.included(klass)
      klass.send :before_filter, :login_required, only: %i[list index]
Severity: Minor
Found in lib/field_mappings_controller.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 extended_content.rb has 540 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rexml/document'
require 'builder'
require 'xmlsimple'

# ExtendedContent provides a way to access additional, extended content directly on a model. (ExtendedContent is included in all
Severity: Major
Found in lib/extended_content.rb - About 1 day to fix

    Assignment Branch Condition size for records_pre_processor is too high. [77.82/15]
    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'
    
    

    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. [107/100]
    Open

    module XmlHelpers
      unless included_modules.include? XmlHelpers
    
        def appropriate_protocol_for(item)
          protocol = 'http'
    Severity: Minor
    Found in lib/xml_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.

    Assignment Branch Condition size for formatted_value_from_xml is too high. [75.69/15]
    Open

      def formatted_value_from_xml(value, ef = nil, item = nil)
        if ef && %w(autocomplete choice).member?(ef.ftype)
          base_url = ef.base_url
    
          # If the extended field type is a choice, then link the value to the search page for the EF.
    Severity: Minor
    Found in app/helpers/application_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

    Severity
    Category
    Status
    Source
    Language