NullVoxPopuli/spiced_rumby

View on GitHub

Showing 64 of 64 total issues

Module has too many lines. [101/100]
Open

    module Colorer
      TIME = '#CC66FF'
      WHISPER_TIME = '#662299'
      NAME = '#007777'
      WHISPER_NAME = '#004444'
Severity: Minor
Found in lib/spiced_rumby/gui/colorer.rb by rubocop

This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method render has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

        def render
          Vedeu.renders do
            view :contacts do
              background SpicedRumby::GUI::Colorer::BACKGROUND

Severity: Minor
Found in lib/spiced_rumby/gui/views/contacts.rb - About 3 hrs 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 too many lines. [33/25] (https://github.com/bbatsov/ruby-style-guide#short-methods)
Open

        def render
          Vedeu.renders do
            view :contacts do
              background SpicedRumby::GUI::Colorer::BACKGROUND

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [31/25] (https://github.com/bbatsov/ruby-style-guide#short-methods)
Open

        def render
          width = Vedeu.width

          Vedeu.render do
            view :welcome do

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for render is too high. [8/7]
Open

        def render
          Vedeu.renders do
            view :contacts do
              background SpicedRumby::GUI::Colorer::BACKGROUND

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Method render has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def render
          Vedeu.renders do
            view :contacts do
              background SpicedRumby::GUI::Colorer::BACKGROUND

Severity: Minor
Found in lib/spiced_rumby/gui/views/contacts.rb - About 1 hr to fix

    Method render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def render
              width = Vedeu.width
    
              Vedeu.render do
                view :welcome do
    Severity: Minor
    Found in lib/spiced_rumby/gui/views/welcome.rb - About 1 hr to fix

      Block has too many lines. [31/25]
      Open

                Vedeu.renders do
                  view :contacts do
                    background SpicedRumby::GUI::Colorer::BACKGROUND
      
                    names.each do |sel, cur, node|

      This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            def chat(msg)
              words = msg.split(' ')
              time = words[0..1]
              name = words[2]
              message = words[3..words.length]
      Severity: Minor
      Found in lib/spiced_rumby/debug/cli_output.rb and 1 other location - About 45 mins to fix
      lib/spiced_rumby/debug/cli_output.rb on lines 46..54

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 41.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            def whisper(msg)
              words = msg.split(' ')
              time = words[0..1]
              name = words[2]
              message = words[3..words.length]
      Severity: Minor
      Found in lib/spiced_rumby/debug/cli_output.rb and 1 other location - About 45 mins to fix
      lib/spiced_rumby/debug/cli_output.rb on lines 35..43

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 41.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Block has too many lines. [29/25]
      Open

                  view :contacts do
                    background SpicedRumby::GUI::Colorer::BACKGROUND
      
                    names.each do |sel, cur, node|
                      is_node = node.is_a?(MeshChat::Node)

      This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

      Block has too many lines. [28/25]
      Open

                Vedeu.render do
                  view :welcome do
                    lines do
                      line
                      line

      This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

      Block has too many lines. [26/25]
      Open

                  view :welcome do
                    lines do
                      line
                      line
                      line do

      This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

      Block has too many lines. [26/25]
      Open

                    names.each do |sel, cur, node|
                      is_node = node.is_a?(MeshChat::Node)
                      name = is_node ? node.alias_name : node
      
                      is_online = node.respond_to?(:online?) ? node.online? : true

      This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

            class << self
              def autocompletes
                commands = MeshChat::CLI::COMMAND_MAP.map { |k, _v| "/#{k}" }
                aliases = MeshChat::Node.all.map { |n| "#{n.alias_name}" }
                commands + aliases
      Severity: Minor
      Found in lib/spiced_rumby/gui/input_hook.rb and 1 other location - About 20 mins to fix
      lib/spiced_rumby/debug/cli_input.rb on lines 4..8

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 28.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

            class << self
              def autocompletes
                commands = MeshChat::CLI::COMMAND_MAP.map { |k, _v| "/#{k}" }
                aliases = MeshChat::Node.all.map { |n| "#{n.alias_name}" }
                commands + aliases
      Severity: Minor
      Found in lib/spiced_rumby/debug/cli_input.rb and 1 other location - About 20 mins to fix
      lib/spiced_rumby/gui/input_hook.rb on lines 4..8

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 28.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              renderer.line do
                stream do
                  foreground WHISPER_TIME
                  text time
                end
      Severity: Minor
      Found in lib/spiced_rumby/gui/colorer.rb and 1 other location - About 15 mins to fix
      lib/spiced_rumby/gui/colorer.rb on lines 74..85

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              renderer.line do
                stream do
                  foreground TIME
                  text time
                end
      Severity: Minor
      Found in lib/spiced_rumby/gui/colorer.rb and 1 other location - About 15 mins to fix
      lib/spiced_rumby/gui/colorer.rb on lines 92..103

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      required_ruby_version (2.0, declared in spiced_rumby.gemspec) and TargetRubyVersion (2.1, declared in .rubocop.yml) should be equal.
      Open

        s.required_ruby_version = '>= 2.0'
      Severity: Minor
      Found in spiced_rumby.gemspec by rubocop

      Checks that required_ruby_version of gemspec and TargetRubyVersion of .rubocop.yml are equal. Thereby, RuboCop to perform static analysis working on the version required by gemspec.

      Example:

      # When `TargetRubyVersion` of .rubocop.yml is `2.3`.
      
      # bad
      Gem::Specification.new do |spec|
        spec.required_ruby_version = '>= 2.2.0'
      end
      
      # bad
      Gem::Specification.new do |spec|
        spec.required_ruby_version = '>= 2.4.0'
      end
      
      # good
      Gem::Specification.new do |spec|
        spec.required_ruby_version = '>= 2.3.0'
      end
      
      # good
      Gem::Specification.new do |spec|
        spec.required_ruby_version = '>= 2.3'
      end
      
      # good
      Gem::Specification.new do |spec|
        spec.required_ruby_version = ['>= 2.3.0', '< 2.5.0']
      end

      Prefer to_s over string interpolation.
      Open

                aliases = MeshChat::Node.all.map { |n| "#{n.alias_name}" }
      Severity: Minor
      Found in lib/spiced_rumby/gui/input_hook.rb by rubocop

      This cop checks for strings that are just an interpolated expression.

      Example:

      # bad
      "#{@var}"
      
      # good
      @var.to_s
      
      # good if @var is already a String
      @var
      Severity
      Category
      Status
      Source
      Language