decko-commons/decko

View on GitHub

Showing 17 of 700 total issues

File content_spec.rb has 367 lines of code (exceeds 250 allowed). Consider refactoring.
Open

RSpec.describe Card::Content do
  EXAMPLES = {
    nests: {
      content: "Some Literals: \\[{I'm not| a link]}, and " \
                '\\{{This Card|Is not Nestd}}' \
Severity: Minor
Found in card/spec/card/content_spec.rb - About 4 hrs to fix

File director_spec.rb has 302 lines of code (exceeds 250 allowed). Consider refactoring.
Open

RSpec.describe "Card::Director" do
  STAGE_MAP = { VI: :initialize,
                VP: :prepare_to_validate,
                VV: :validate,
                SP: :prepare_to_store,
Severity: Minor
Found in card/spec/card/director_spec.rb - About 3 hrs to fix

Class View has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

  class View
    module Options
      # VooApi methods let developers use view options dynamically.
      module VooApi
        # There are two primary options hashes:
Severity: Minor
Found in card/lib/card/view/options/voo_api.rb - About 2 hrs to fix

Class Format has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Format
    # View rendering methods.
    #
    module Render
      # view=open&layout=simple
Severity: Minor
Found in card/lib/card/format/render.rb - About 2 hrs to fix

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

    def parts_minus keys_to_ignore
      parts.map do |part|
        next if part.empty?
        next if part =~ /^_/ # this removes relative parts.  why?
        next if keys_to_ignore.member? part.to_name.key
Severity: Minor
Found in cardname/lib/cardname/contextual.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 cards_with_disposable_attachments has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def cards_with_disposable_attachments
    draft_actions_with_attachment.each do |action|
      # we don't want to delete uploads in progress
      next unless old_enough?(action.created_at) && (card = action.card)
      # we can't delete attachments we don't have write access to
Severity: Minor
Found in mod/carrierwave/set/all/file_utils.rb - About 45 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 perform has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

          def perform act_id, card, card_attribs, env, auth, method_name
Severity: Minor
Found in card/lib/card/set/event/delayed_event.rb - About 45 mins to fix

Method match_prefices has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def match_prefices prefix_regexp
        while match_prefix prefix_regexp
          @match, @offset = current_match
          # see whether the full chunk actually matches
          # (as opposed to bogus prefix)
Severity: Minor
Found in card/lib/card/content/parser.rb - About 45 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 contextualize_delayed_event has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def contextualize_delayed_event act_id, card, env, auth, &block
Severity: Minor
Found in card/lib/card/director/event_delay.rb - About 35 mins to fix

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize component, name, html_class, tag_opts={}, &tag_block
Severity: Minor
Found in mod/bootstrap/lib/card/bootstrap/tag_method.rb - About 35 mins to fix

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize format, action, header=true, action_view=:summary, hide_diff=false
Severity: Minor
Found in mod/history/lib/card/action/action_renderer.rb - About 35 mins to fix

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

      def define_test_event stage, subcard
        test_event stage, on: :create do
          yield name
          subcard "112v" if subcard && name == "11"
        end
Severity: Minor
Found in card/spec/card/director_spec.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 swap_all_subsequences has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def swap_all_subsequences oldseq, newseq
      res = []
      i = 0
      while i <= num_parts - oldseq.num_parts
        # for performance reasons: check first character first then the rest
Severity: Minor
Found in cardname/lib/cardname/manipulate.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 direct_follower_ids_for_set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def direct_follower_ids_for_set set_card, ids
  set_card.all_user_ids_with_rule_for(:follow).each do |user_id|
    next if ids.include?(user_id) || !(option = follow_rule_option user_id)

    yield user_id, set_card, option if block_given?
Severity: Minor
Found in mod/follow/set/all/follow/follower_ids.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 each_type_assigning_module_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def each_type_assigning_module_key
          patterns.each do |p|
            next unless p.assigns_type

            module_key = p.module_key
Severity: Minor
Found in card/lib/card/set/pattern/all.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 pluck_in_batches has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def pluck_in_batches *columns, batch_size: 1000
        batch_start = nil
        select_columns, id_index, remove_id = prepare_batch_pluck columns

        loop do
Severity: Minor
Found in card/config/initializers/02_patches/active_record.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 card_form_html_opts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def card_form_html_opts action, opts={}
    add_class opts, "card-form"
    add_class opts, "slotter" unless opts[:redirect] || opts[:no_slotter]
    add_class opts, "autosave" if action == :update
    interpret_main_success_opts opts
Severity: Minor
Found in mod/edit/set/all/form.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