Showing 4,033 of 4,033 total issues

Assignment Branch Condition size for populate_result_sets_for is too high. [129.7/15]
Open

  def populate_result_sets_for(zoom_class)
    # potential elements of query
    # zoom_class and optionally basket
    # search_terms which search both title attribute and all content attribute
    # source_item for things related to item

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. [120/10]
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 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. [204/100]
Open

module FlaggingController
  unless included_modules.include? FlaggingController
    # set up our helper methods
    def self.included(klass)
      klass.helper_method :can_preview?
Severity: Minor
Found in lib/flagging_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.

Method importer_prepare_extended_field has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
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 - 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. [194/100]
Open

class UserNotifier < ActionMailer::Base
  default from: SystemSetting.notifier_email.to_s

  # kludge for A_S and rails 2.0
  def generic_view_paths
Severity: Minor
Found in app/mailers/user_notifier.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.

Method has too many lines. [114/10]
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 if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

class ImportersController < ApplicationController
  include WorkerControllerHelpers

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

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

  def index
    if !@current_basket.index_page_redirect_to_all.blank?
      redirect_to_all_for(@current_basket.index_page_redirect_to_all)
    else
      @privacy_type = @current_basket.show_privacy_controls_with_inheritance? && permitted_to_view_private_items? ? 'private' : 'public'
Severity: Minor
Found in app/controllers/index_page_controller.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. [190/100]
Open

class ZoomIndexRebuildWorker < BackgrounDRb::MetaWorker
  set_worker_name :zoom_index_rebuild_worker
  set_no_auto_load true

  # for prepare_to_zoom, etc.

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 index is too high. [114.4/15]
Open

  def index
    if !@current_basket.index_page_redirect_to_all.blank?
      redirect_to_all_for(@current_basket.index_page_redirect_to_all)
    else
      @privacy_type = @current_basket.show_privacy_controls_with_inheritance? && permitted_to_view_private_items? ? 'private' : 'public'

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

class SearchPresenter
  include ActionView::Helpers::NumberHelper
  include ActionView::Helpers::UrlHelper

  private
Severity: Minor
Found in app/models/search_presenter.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. [181/100]
Open

module OaiZoom
  unless included_modules.include? OaiZoom
    def self.included(klass)
      klass.send :include, OaiDcHelpers
      klass.send :include, ZoomHelpers
Severity: Minor
Found in lib/oai_zoom.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 create_new_item_from_record has a Cognitive Complexity of 80 (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/workers/past_perfect4_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

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

  def index
    if !@current_basket.index_page_redirect_to_all.blank?
      redirect_to_all_for(@current_basket.index_page_redirect_to_all)
    else
      @privacy_type = @current_basket.show_privacy_controls_with_inheritance? && permitted_to_view_private_items? ? 'private' : 'public'

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.

File topic_test.rb has 686 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require File.dirname(__FILE__) + '/../test_helper'

class TopicTest < ActiveSupport::TestCase
  # fixtures preloaded
  include KeteUrlFor
Severity: Major
Found in old_test/unit/topic_test.rb - About 1 day to fix

    Block has too many lines. [170/25]
    Open

    feature 'Topic comments', js: true do
      let(:user)            { FactoryGirl.create(:user, :activated, :with_default_baskets) }
      let(:topic)           { FactoryGirl.create(:topic, creator: user)                    }
      let(:show_topic_path) { basket_topic_path(topic.basket.urlified_name, topic.id)      }
    
    

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Assignment Branch Condition size for get_progress is too high. [107.8/15]
    Open

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

    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

    Assignment Branch Condition size for search is too high. [107.9/15]
    Open

      def search
        @search = Search.new
    
        # all returns all results for a class, contributor_id, or source_item (i.e. all related items to source)
        # it is the default if the search_terms parameter is not defined

    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 SystemSetting has 82 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class SystemSetting
      module Defaults
        # RABID:
        #
        # Defaults, mostly taken from the system_setting table on an existing
    Severity: Major
    Found in app/models/system_setting.rb - About 1 day to fix

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

      module KeteAuthorisationSettings
        # ROB:  This could possibly be a helper rather than a model.
      
        # ROB:  We're going to switch from Kete's custom login system to devise.
        #

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

      Severity
      Category
      Status
      Source
      Language