Showing 43 of 44 total issues

Method terminal_width has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def terminal_width # :nodoc:
      if @terminal_columns.nonzero?
        result = @terminal_columns
      else
        result = unix? ? dynamic_width : 80
Severity: Minor
Found in lib/rake/application.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 display_tasks_and_comments has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def display_tasks_and_comments # :nodoc:
      displayable_tasks = tasks.select { |t|
        (options.show_all_tasks || t.comment) &&
          t.name =~ options.show_task_pattern
      }
Severity: Minor
Found in lib/rake/application.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 make_sources has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def make_sources(task_name, task_pattern, extensions)
      result = extensions.map { |ext|
        case ext
        when /%/
          task_name.pathmap(ext)
Severity: Minor
Found in lib/rake/task_manager.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 define has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def define
      desc @description
      task @name => Array(deps) do
        FileUtilsExt.verbose(@verbose) do
          puts "Use TESTOPTS=\"--verbose\" to pass --verbose" \
Severity: Minor
Found in lib/rake/testtask.rb - About 1 hr to fix

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

        def load_imports # :nodoc:
          while fn = @pending_imports.shift
            next if @imported.member?(fn)
            fn_task = lookup(fn) and fn_task.invoke
            ext = File.extname(fn)
    Severity: Minor
    Found in lib/rake/application.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 raw_load_rakefile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def raw_load_rakefile # :nodoc:
          rakefile, location = find_rakefile_location
          if (!options.ignore_system) &&
              (options.load_system || rakefile.nil?) &&
              system_dir && File.directory?(system_dir)
    Severity: Minor
    Found in lib/rake/application.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 ext has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def ext(newext="")
          return self.dup if [".", ".."].include? self
          if newext != ""
            newext = "." + newext unless newext =~ /^\./
          end
    Severity: Minor
    Found in lib/rake/ext/string.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 excluded_from_list? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def excluded_from_list?(fn)
          return true if @exclude_patterns.any? do |pat|
            case pat
            when Regexp
              fn =~ pat
    Severity: Minor
    Found in lib/rake/file_list.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 safe_ln has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def safe_ln(*args, **options)
        if LN_SUPPORTED[0]
          begin
            return options.empty? ? ln(*args) : ln(*args, **options)
          rescue StandardError, NotImplementedError
    Severity: Minor
    Found in lib/rake/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 attempt_rule has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def attempt_rule(task_name, task_pattern, args, extensions, block, level)
    Severity: Minor
    Found in lib/rake/task_manager.rb - About 45 mins to fix

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

          def execute(args=nil)
            args ||= EMPTY_TASK_ARGS
            if application.options.dryrun
              application.trace "** Execute (dry run) #{name}"
              return
      Severity: Minor
      Found in lib/rake/task.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 define_task has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def define_task(task_class, *args, &block) # :nodoc:
            task_name, arg_names, deps, order_only = resolve_args(args)
      
            original_scope = @scope
            if String === task_name and
      Severity: Minor
      Found in lib/rake/task_manager.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 pathmap has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def pathmap(spec=nil, &block)
            return self if spec.nil?
            result = "".dup
            spec.scan(/%\{[^}]*\}-?\d*[sdpfnxX%]|%-?\d+d|%.|[^%]+/) do |frag|
              case frag
      Severity: Minor
      Found in lib/rake/ext/string.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 resolve_args_with_dependencies has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def resolve_args_with_dependencies(args, hash) # :nodoc:
            fail "Task Argument Error" if
              hash.size != 1 &&
              (hash.size != 2 || !hash.key?(:order_only))
            order_only = hash.delete(:order_only)
      Severity: Minor
      Found in lib/rake/task_manager.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 pathmap_explode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def pathmap_explode
            head, tail = File.split(self)
            return [self] if head == self
            return [tail] if head == "." || tail == "/"
            return [head, tail] if head == "/"
      Severity: Minor
      Found in lib/rake/ext/string.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 file_already_gone? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def file_already_gone?(file_name)
            return false if File.exist?(file_name)
      
            path = file_name
            prev = nil
      Severity: Minor
      Found in lib/rake/clean.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 exclude has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def exclude(*patterns, &block)
            patterns.each do |pat|
              if pat.respond_to? :to_ary
                exclude(*pat.to_ary)
              else
      Severity: Minor
      Found in lib/rake/file_list.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 have_rakefile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def have_rakefile # :nodoc:
            @rakefiles.each do |fn|
              if File.exist?(fn)
                others = FileList.glob(fn, File::FNM_CASEFOLD)
                return others.size == 1 ? others.first : fn
      Severity: Minor
      Found in lib/rake/application.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 pathmap_replace has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def pathmap_replace(patterns, &block)
            result = self
            patterns.split(";").each do |pair|
              pattern, replacement = pair.split(",")
              pattern = Regexp.new(pattern)
      Severity: Minor
      Found in lib/rake/ext/string.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 win32_system_dir has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def win32_system_dir #:nodoc:
              win32_shared_path = ENV["HOME"]
              if win32_shared_path.nil? && ENV["HOMEDRIVE"] && ENV["HOMEPATH"]
                win32_shared_path = ENV["HOMEDRIVE"] + ENV["HOMEPATH"]
              end
      Severity: Minor
      Found in lib/rake/win32.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