hicknhack-software/redmine_hourglass

View on GitHub

Showing 27 of 33 total issues

Method []= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def []=(*args)
        project, new_settings = parse_assign_params(*args.reverse)

        settings = get.call
        if project
Severity: Minor
Found in lib/hourglass/settings_storage.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def update(attributes)
      round = attributes.delete :round
      ActiveRecord::Base.transaction do
        result = super attributes
        if booked?
Severity: Minor
Found in app/models/hourglass/time_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 evaluate_entry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def evaluate_entry(entry, error_preface)
      if entry
        if entry.is_a? String
          @bulk_errors.push "#{error_preface} #{entry}"
        elsif entry.errors.empty?
Severity: Minor
Found in app/controllers/hourglass/api_base_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 parse_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_type(type, attribute)
    if Rails::VERSION::MAJOR <= 4
      case type
      when :boolean
        ActiveRecord::Type::Boolean.new.type_cast_from_user(attribute)
Severity: Minor
Found in app/models/concerns/hourglass/type_parsing.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 retrieve_query has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def retrieve_query(force_new: params[:set_filter] == '1')
    @query = if force_new || session[session_query_var_name].nil?
               new_query
             elsif params[:query_id].present?
               query_from_id
Severity: Minor
Found in app/controllers/concerns/query_concern.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 total_for_hours has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def total_for_hours(scope)
      scope = scope.group(main_query.group_by_statement) if main_query.group_by_statement
      scope.group("#{TimeEntry.table_name}.project_id").sum("#{TimeEntry.table_name}.hours").each_with_object({}) do |((date, column, project_id), total), totals|
        totals[date] ||= {}
        totals[date][column] ||= {}
Severity: Minor
Found in app/models/hourglass/chart_query.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 hourglass_asset_paths has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def hourglass_asset_paths(type, sources)
      options = sources.extract_options!
      if options[:plugin] == Hourglass::PLUGIN_NAME && Rails.env.production?
        plugin = options.delete(:plugin)
        sources.map! do |source|
Severity: Minor
Found in app/helpers/hourglass/application_helper.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