MiraitSystems/enju_trunk

View on GitHub

Showing 804 of 1,155 total issues

Method has_view_role? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def has_view_role?(current_role_id)
    current_role_id = Role.default_role.id unless current_role_id
    if self.required_role_id <= current_role_id && (self.shelf.required_role_id.nil? || self.shelf.required_role_id <= current_role_id)
      return TRUE
    else
Severity: Minor
Found in app/models/item.rb - About 25 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 convert_isbn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def convert_isbn
    if identifier_type.name == 'isbn'
      lisbn = Lisbn.new(body)
      if lisbn.isbn
        if lisbn.isbn.length == 10
Severity: Minor
Found in app/models/identifier.rb - About 25 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 item_non_searchable? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def item_non_searchable?
    return false if periodical_master
    items.each do |i|
      return false unless i.non_searchable
      return false if item.try(:circulation_status).try(:name) != 'Removed'
Severity: Minor
Found in app/models/manifestation.rb - About 25 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 find_series_statement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def find_series_statement(row)
    issn = nil
    if row['issn'].present?
      issn = Lisbn.new(row['issn'].to_s)
    end
Severity: Minor
Found in app/models/resource_import_file.rb - About 25 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 add_subject has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_subject(terms)
    terms.to_s.split(';').each do |s|
      s = s.to_s.exstrip_with_full_size_space
      subject = Subject.where(:term => s).first
      unless subject
Severity: Minor
Found in app/models/manifestation.rb - About 25 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 set_full_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def set_full_name
    #puts "@@@"
    #puts self
    #puts "@@@"

Severity: Minor
Found in app/models/agent.rb - About 25 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 ptbl_group has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def ptbl_group # book only
        results = []
        parent_manifestations = @manifestation.original_manifestations || []
        parent_manifestations.each do |manifestation|
          if manifestation.nacsis_identifier
Severity: Minor
Found in app/models/nacsis_cat.rb - About 25 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_series_statement_from_nacsis_cat has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def new_series_statement_from_nacsis_cat(nacsis_cat, root_manifestation = nil)
        return nil if nacsis_cat.blank?
        series_statement = root_manifestation.series_statement
        series_statement = SeriesStatement.where(:root_manifestation_id => root_manifestation.id).first unless series_statement && !root_manifestation
        series_statement = SeriesStatement.new unless series_statement
Severity: Minor
Found in app/models/nacsis_cat.rb - About 25 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_fields_and has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.search_fields_and(params, sort = {:sort_by => 'id', :order => 'desc'})
    t = self.arel_table
    user_request_logs = self.order("#{sort[:sort_by]} #{sort[:order]}")
    if params[:user_id].present?
      user_request_logs = user_request_logs.where(:user_id => params[:user_id])
Severity: Minor
Found in app/models/user_request_log.rb - About 25 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 last_updated_at has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def last_updated_at
    if answers.last
      time = answers.last.updated_at
    end
    if time
Severity: Minor
Found in app/models/question.rb - About 25 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 volg_group has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def volg_group # book only
        results = []
        identifier_type = IdentifierType.where(:name => 'isbn').first
        manifestations = @manifestation.series_statement.try(:manifestations)
        if manifestations
Severity: Minor
Found in app/models/nacsis_cat.rb - About 25 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_duplicate_user has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def check_duplicate_user
    return if SystemConfiguration.get("agent.check_duplicate_user").nil? || SystemConfiguration.get("agent.check_duplicate_user") == false
    return if self.full_name_transcription.blank? or self.birth_date.blank? or self.telephone_number_1.blank?
    chash = {}
    chash[:full_name_transcription] = self.full_name_transcription.strip
Severity: Minor
Found in app/models/agent.rb - About 25 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 change_note has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def change_note
    data = Agent.find(self.id).note rescue nil
    unless data == self.note
      self.note_update_at = Time.zone.now
      if User.current_user.nil?
Severity: Minor
Found in app/models/agent.rb - About 25 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_manifestation_from_nbn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def update_manifestation_from_nbn(manifestation, book_types = ManifestationType.book.all, nacsis_cat = nil, index = nil)
      raise ArgumentError if manifestation.blank?
      raise ArgumentError if manifestation.nbn.blank?
      if nacsis_cat.nil?
        result = NacsisCat.search(nbn: manifestation.nbn)
Severity: Minor
Found in app/models/nacsis_cat.rb - About 25 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 get_volg_manifestation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def get_volg_manifestation(nbn, vol)
        return nil if nbn.blank? || vol.blank?
        manifestation = Manifestation.where(:nbn => nbn, :edition_display_value => vol).first
        manifestation = Manifestation.where(:nbn => nbn, :volume_number_string => vol).first unless manifestation
        volume_numbers = [vol.gsub(I18n.t('nacsis_cat.replace_volume_1'),''),
Severity: Minor
Found in app/models/nacsis_cat.rb - About 25 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 get_user has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.get_user(identifier)
    user = User.where(:user_number => identifier).first
    user = User.where(:username => identifier).first unless user
    unless user
      agent = Agent.where(:agent_identifier => identifier).first
Severity: Minor
Found in app/models/user.rb - About 25 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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    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 25 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 validate_identifier has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_identifier
    return if self.manifestation_id

    if self.identifier.blank?
    errors.add(I18n.t('activerecord.attributes.manifestation.identifier'), I18n.t('approval.no_blank_identifier'))
Severity: Minor
Found in app/models/approval.rb - About 25 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 filter_by_selection_field! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def filter_by_selection_field!(field, form_input, &block)
        return if @search.blank?
        return if form_input.blank?

        valid, invalid = normalize_multi_choice(form_input, &block)
Severity: Minor
Found in app/controllers/nacsis_user_requests_controller.rb - About 25 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 has_role? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def has_role?(role_in_question)
    return false unless role
    return true if role.name == role_in_question
    case role.name
    when 'Administrator'
Severity: Minor
Found in app/models/user.rb - About 25 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