anshulverma/cliqr

View on GitHub

Showing 12 of 12 total issues

Method invoke has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def invoke(event_name, parent_event, *args)
        handled = false
        current_config = @config
        event = build_event(event_name, parent_event)
        loop do
Severity: Minor
Found in lib/cliqr/events/invoker.rb - About 1 hr 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 do_validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

          def do_validate(name, values, errors)
            valid = true
            iterator(values) do |value, key|
              valid = false unless value.valid?
              value.errors.each do |error|
Severity: Minor
Found in lib/cliqr/config/validation/validator_factory.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 type_of? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def type_of?(argument, required_type)
        case required_type
        when Config::NUMERIC_ARGUMENT_TYPE
          Integer(argument)
        when Config::BOOLEAN_ARGUMENT_TYPE
Severity: Minor
Found in lib/cliqr/argument_validation/argument_type_validator.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 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize(config, options, arguments, environment, executor, output_stream)
Severity: Minor
Found in lib/cliqr/command/command_context.rb - About 45 mins to fix

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

          def get_token(arg = nil)
            if arg.nil?
              Token.new
            else
              case arg
    Severity: Minor
    Found in lib/cliqr/parser/token_factory.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 do_validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

              def do_validate(name, value, errors)
                unless value.nil?
                  local_errors = ValidationErrors.new
                  local_errors.add("'#{name}' cannot be empty") \
                    if value.respond_to?(:empty?) && value.empty?
    Severity: Minor
    Found in lib/cliqr/config/validation/validator_factory.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_version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_version
            return self unless version?
            add_action(Cliqr::Util.build_version_action(self)) unless action?('version')
            add_option(Cliqr::Util.build_version_option(self)) unless option?('version')
          end
    Severity: Minor
    Found in lib/cliqr/config/command.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def run
            loop do
              command = prompt
              execute(command) unless command == 'exit'
              break if command == 'exit'
    Severity: Minor
    Found in lib/cliqr/command/shell_command.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 do_validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

              def do_validate(name, value, errors)
                begin
                  return if value.is_a?(@super_type) || \
                            (value.respond_to?(:<) ? value < @super_type : value.is_a?(@super_type))
                rescue ArgumentError
    Severity: Minor
    Found in lib/cliqr/config/validation/validator_factory.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 build_shell_action has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.build_shell_action(config, shell_config)
          Cliqr::Config::Action.new.tap do |action_config|
            action_config.name = if shell_config.name?
                                   shell_config.name
                                 else
    Severity: Minor
    Found in lib/cliqr/util.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def execute(command)
            return if command.empty?
            action_name = command.split(' ').first
            unless @context.action?(action_name)
              @context.puts "unknown action \"#{action_name}\""
    Severity: Minor
    Found in lib/cliqr/command/shell_command.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 add_help has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_help
            return self unless help?
            add_action(Cliqr::Util.build_help_action(self)) unless action?('help')
            add_option(Cliqr::Util.build_help_option(self)) unless option?('help')
          end
    Severity: Minor
    Found in lib/cliqr/config/action.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