gavinlaking/vedeu

View on GitHub

Showing 47 of 67 total issues

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

      def output
        Vedeu.timer("Drawing border: '#{name}'") do
          [
            (top if top?),
            (left if left?),
Severity: Minor
Found in lib/vedeu/borders/refresh.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 bordered_height has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def bordered_height
        return height unless border && enabled?

        if top? && bottom?
          height - 2
Severity: Minor
Found in lib/vedeu/geometries/area/area.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 stream has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def stream(value = '', opts = {}, &block)
        requires_model!

        attrs = build_attributes(value, opts, &block)

Severity: Minor
Found in lib/vedeu/dsl/elements.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize(context = nil,
                     model   = nil,
                     value   = '',
                     options = {},
                     &block)
Severity: Minor
Found in lib/vedeu/dsl/helpers/attributes.rb - About 35 mins to fix

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

          def self.build(context = nil,
                         model   = nil,
                         value   = '',
                         options = {},
                         &block)
    Severity: Minor
    Found in lib/vedeu/dsl/helpers/attributes.rb - About 35 mins to fix

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

          def self.execute!(argv = [],
                            stdin  = STDIN,
                            stdout = STDOUT,
                            stderr = STDERR,
                            kernel = Kernel)
      Severity: Minor
      Found in lib/vedeu/runtime/launcher.rb - About 35 mins to fix

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

            def initialize(argv   = [],
                           stdin  = STDIN,
                           stdout = STDOUT,
                           stderr = STDERR,
                           kernel = Kernel)
        Severity: Minor
        Found in lib/vedeu/runtime/launcher.rb - About 35 mins to fix

          Method pair has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def pair
                  if maximised?
                    [1, default]
          
                  elsif bottom_aligned? || right_aligned?
          Severity: Minor
          Found in lib/vedeu/geometries/area/dimension.rb - About 35 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_action has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_action(controller, action)
                  if present?(controller) && present?(action)
                    Vedeu.log(type:    :create,
                              message: "Action: ':#{action}' " \
                                       "(for ':#{controller}')")
          Severity: Minor
          Found in lib/vedeu/runtime/router.rb - About 35 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 coerce has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def coerce
                  if coerced?
                    value
          
                  elsif value.is_a?(Vedeu::Models::Row)
          Severity: Minor
          Found in lib/vedeu/coercers/page.rb - About 35 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 stop has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def stop
                  log('Attempting to stop')
          
                  return not_enabled unless Vedeu.config.drb?
          
          
          Severity: Minor
          Found in lib/vedeu/distributed/server.rb - About 35 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 coerce has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def coerce
                  raise Vedeu::Error::InvalidSyntax unless hash?(value)
          
                  if colour? && hash?(colour)
                    Vedeu::Coercers::ColourAttributes.coerce(colour)
          Severity: Minor
          Found in lib/vedeu/coercers/colour_attributes.rb - About 35 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 read has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def read
                  keys = console.getch
          
                  if keys.ord == Vedeu::ESCAPE_KEY_CODE
                    keys << console.read_nonblock(4) rescue nil
          Severity: Minor
          Found in lib/vedeu/input/raw.rb - About 35 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 switch_mode! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def switch_mode!(mode = nil)
                  if present?(mode) && valid_mode?(mode)
                    Vedeu.configure { |config| config.terminal_mode = mode }
          
                  else
          Severity: Minor
          Found in lib/vedeu/terminal/mode.rb - About 35 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 _dn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def _dn
                  if dn
                    dn
          
                  elsif d.nil? && d_dn
          Severity: Minor
          Found in lib/vedeu/geometries/area/dimension.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 items has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def items
                  items = []
                  collection.each_with_index do |item, index|
                    items << if index == @current && index == @selected
                               [true, true, item]
          Severity: Minor
          Found in lib/vedeu/menus/menu.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 compress has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  def compress
                    Vedeu.timer('Removing duplicate cells...') do
                      content.map do |cell|
                        character = character_for(cell)
          
          
          Severity: Minor
          Found in lib/vedeu/output/compressors/character.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 snake_case has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def snake_case(klass)
                str = klass.is_a?(Module) ? klass.name : klass
          
                str.split(/::/).map do |namespace|
                  *upper, _ = namespace.split(/([A-Z]+)/).reject(&:empty?).map do |chars|
          Severity: Minor
          Found in lib/vedeu/common.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 escape_sequence has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def escape_sequence
                  return '' if empty?
          
                  if registered?(colour)
                    retrieve(colour)
          Severity: Minor
          Found in lib/vedeu/colours/translator.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 end_coordinate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def end_coordinate
                  if d_dn
                    (d_dn > default) ? default : d_dn
          
                  elsif dn
          Severity: Minor
          Found in lib/vedeu/geometries/area/dimension.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