MiraitSystems/enju_trunk

View on GitHub

Showing 1,155 of 1,155 total issues

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

    def perform
      user_file = UserFile.new(user)

      # get data
      query = Marshal.load(dumped_query)
Severity: Minor
Found in app/models/item.rb - About 55 mins 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 check_upload_params has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def check_upload_params(id, db_type, command)
        return unless id
        return unless (['BHOLD','SHOLD','BOOK','SERIAL'].include?(db_type))
        return unless (['insert','update','delete'].include?(command))
        case db_type
Severity: Minor
Found in app/models/nacsis_cat.rb - About 55 mins 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 new_work_has_titles_from_nacsis_cat has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def new_work_has_titles_from_nacsis_cat(nacsis_cat)
        return [] if nacsis_cat.blank?
        nacsis_info = nacsis_cat.detail
        wht_ary = []
        nacsis_info[:other_titles].each do |other_title|
Severity: Minor
Found in app/models/nacsis_cat.rb - About 55 mins 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_image has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def show_image(picture_file, options = {:size => :medium})
    geometry = Paperclip::Geometry.from_file(picture_file.picture)
    case options[:size]
    when :medium
      if geometry.width.to_i >= 600
Severity: Minor
Found in app/helpers/picture_files_helper.rb - About 55 mins 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 search_name has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def search_name
    struct_classification = Struct.new(:id, :text)
    if params[:shelf_id]
      shelf = Shelf.where(id: params[:shelf_id]).select("id, display_name, name").first
      result = shelf ? struct_classification.new(shelf.id, "#{shelf.display_name}(#{shelf.name})") : nil
Severity: Minor
Found in app/controllers/shelves_controller.rb - About 55 mins 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 carrier_type_facet has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def carrier_type_facet(facet)
    string = ''
    carrier_type = CarrierType.where(:name => facet.value).select([:name, :display_name, :icon_filename]).first
    if carrier_type
      if icon = form_icon(carrier_type)
Severity: Minor
Found in app/helpers/manifestations_helper.rb - About 55 mins 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    unless SystemConfiguration.get("user_show_questions")
      unless current_user.has_role?('Librarian')
        access_denied; return
      end
Severity: Minor
Found in app/controllers/questions_controller.rb - About 55 mins 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 search_name has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def search_name
    struct_classification = Struct.new(:id, :text)
    if params[:sub_carrier_type_id]
      sub_carrier_type = SubCarrierType.where(id: params[:sub_carrier_type_id]).select("id, display_name, name").first
      result = struct_classification.new(sub_carrier_type.id, "#{sub_carrier_type.display_name}(#{sub_carrier_type.name})")
Severity: Minor
Found in app/controllers/sub_carrier_types_controller.rb - About 55 mins 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    unless @agent.user.blank?
      access_denied; return
    end

Severity: Minor
Found in app/controllers/agents_controller.rb - About 55 mins 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 send_reminder has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def send_reminder
    reminder_lists = ReminderList.where("id in (#{params[:send_reminder].join(',')})") rescue []
    if reminder_lists.empty?
      flash[:message] = t('reminder_list.failed_sent')
    else
Severity: Minor
Found in app/controllers/reminder_lists_controller.rb - About 55 mins 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 do_file_output_proccess has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def do_file_output_proccess(search_opts, search)
    return false unless search_opts[:index] == :local
    return false unless search_opts[:output_mode]

    # TODO: 第一引数にparamsまたは生成した検索語、フィルタ指定を渡すようにして、バックグラウンドファイル生成で一時ファイルを作らなくて済むようにする
Severity: Minor
Found in app/controllers/manifestations_controller.rb - About 55 mins 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 destroy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def destroy
    signed_in = signed_in?(resource_name)
    if params[:opac]
      redirect_path = opac_path
    else
Severity: Minor
Found in app/controllers/devise/sessions_controller.rb - About 55 mins 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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    @errors = []
    error = Struct.new(:id, :msg, :v)
    params[:system_configurations].each do |id, value|
      begin
Severity: Minor
Found in app/controllers/system_configurations_controller.rb - About 55 mins 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 daily_report has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def daily_report
   @library_reports = LibraryReport.where(:id => params[:id]) rescue nil
   yyyymmdd = @library_reports[0].yyyymmdd.to_s unless @library_reports.empty?
   yyyymmdd = params[:library_report][:yyyymmdd].to_s if params[:library_report] && params[:library_report][:yyyymmdd]
   library_ids = params[:library]
Severity: Minor
Found in app/controllers/library_reports_controller.rb - About 55 mins 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 search_name has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def search_name
    struct_classification = Struct.new(:id, :text)
    if params[:budget_category_id]
      budget_category = BudgetCategory.where(id: params[:budget_category_id]).select("id, display_name, name").first
      result = struct_classification.new(budget_category.id, "#{budget_category.display_name}(#{budget_category.name})")
Severity: Minor
Found in app/controllers/budget_categories_controller.rb - About 55 mins 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 check_data_is_integer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def check_data_is_integer(field_value, field_name, options = {:mode => 'create'})
      if options[:mode] == "delete"
        return nil if field_value.nil? or field_value.blank?
      end
      return nil unless field_value
Severity: Minor
Found in lib/enju_trunk/resourceadapter/import_book.rb - About 55 mins 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 data_manifestation_type has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def data_manifestation_type(datas, sheet, manifestation)
      return if SystemConfiguration.get('manifestations.split_by_type')

      data_manifestation_type = sheet.field_data(datas, 'book.manifestation_type')
      manifestation_type = manifestation.manifestation_type if manifestation
Severity: Minor
Found in lib/enju_trunk/resourceadapter/import_book.rb - About 55 mins 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_params has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def to_params
        params = { :q => @keywords }
        params[:fl] = '* score'
        params[:qf] = @fulltext_fields.values.map { |field| field.to_boosted_field }.join(' ')
        params[:defType] = 'edismax'
Severity: Minor
Found in lib/plugins/ext/sunspot/dismax.rb - About 55 mins 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 each_row_with_index has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def each_row_with_index
      if @excelx
        data_row_num = article_sheet? ? ResourceImport::ARTICLE_DATA_ROW : ResourceImport::BOOK_DATA_ROW
        data_row_num.upto(@excelx.last_row(@excelx_sheet)) do |row_num|
          yield(@excelx.row(row_num, @excelx_sheet), row_num)
Severity: Minor
Found in lib/enju_trunk/resourceadapter/resource_import.rb - About 55 mins 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 term_check has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def term_check(start_d, end_d)
      return t('page.exstatistics.nil_date') if start_d.blank? or end_d.blank?
      return t('page.exstatistics.invalid_input_date') unless start_d =~ /^((\d+)-?)*\d$/
      return t('page.exstatistics.invalid_input_date') unless end_d =~ /^((\d+)-?)*\d$/
      return t('page.exstatistics.invalid_input_date') if date_format_check(start_d) == nil
Severity: Minor
Found in lib/enju_trunk/enju_trunk_helper.rb - About 55 mins 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