cj/opal-webpack

View on GitHub
lib/compiler_patches/pathname.rb

Summary

Maintainability
D
1 day
Test Coverage

Method plus has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    def plus(path1, path2) # -> path # :nodoc:
      prefix2 = path2
      index_list2 = []
      basename_list2 = []
      while r2 = chop_basename(prefix2)
Severity: Minor
Found in lib/compiler_patches/pathname.rb - About 5 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 relative_path_from has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def relative_path_from(base_directory)
      dest_directory = self.cleanpath.to_s
      base_directory = base_directory.cleanpath.to_s
      dest_prefix = dest_directory
      dest_names = []
Severity: Minor
Found in lib/compiler_patches/pathname.rb - About 2 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 join has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def join(*args)
      return self if args.empty?
      result = args.pop
      result = Pathname.new(result) unless Pathname === result
      return result if result.absolute?
Severity: Minor
Found in lib/compiler_patches/pathname.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 plus has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def plus(path1, path2) # -> path # :nodoc:
      prefix2 = path2
      index_list2 = []
      basename_list2 = []
      while r2 = chop_basename(prefix2)
Severity: Minor
Found in lib/compiler_patches/pathname.rb - About 1 hr to fix

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

        def relative_path_from(base_directory)
          dest_directory = self.cleanpath.to_s
          base_directory = base_directory.cleanpath.to_s
          dest_prefix = dest_directory
          dest_names = []
    Severity: Minor
    Found in lib/compiler_patches/pathname.rb - About 1 hr to fix

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

          def initialize(path)
            if Pathname === path
              @path = path.path.to_s
            elsif path.respond_to?(:to_path)
              @path = path.to_path
      Severity: Minor
      Found in lib/compiler_patches/pathname.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

      There are no issues that match your filters.

      Category
      Status