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

    def stub_old_plugin
      Object.const_set :TimeTracker, Class.new(ActiveRecord::Base) unless const_defined?(:TimeTracker)
      stub_old_time_log unless const_defined?(:TimeLog)
      stub_old_time_booking unless const_defined?(:TimeBooking)
    end
Severity: Minor
Found in lib/hourglass/redmine_time_tracker_import.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 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

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

  def find_project
    @project = Project.visible.find(params[:project_id]) if params[:project_id]
    render_403 unless User.current.allowed_to?(:save_queries, @project, global: true)
  rescue ActiveRecord::RecordNotFound
    render_404
Severity: Minor
Found in app/controllers/hourglass_queries_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

Severity
Category
Status
Source
Language