timcolonel/wow

View on GitHub

Showing 11 of 15 total issues

Class Version has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

class Wow::Package::Version
  include Comparable

  VERSION_REGEX = /
    \A
Severity: Minor
Found in lib/wow/package/version.rb - About 2 hrs to fix

    Class Specification has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Wow::Package::Specification
      include ActiveModel::Validations
      include Wow::Package::SpecAttributes
    
      # User config
    Severity: Minor
    Found in lib/wow/package/specification.rb - About 2 hrs to fix

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

        def find(key)
          return self if @name == key
          @children.each do |child|
            next unless child.respond_to?(:find)
            match = child.find(key)
      Severity: Minor
      Found in lib/struct/tree.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 get_package has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def get_package(name, version_range = nil, prerelease: nil)
          installed_package = self.class.find_installed_package(name, version_range,
                                                                prerelease: prerelease)
          if installing? && installed_package
            installed_package
      Severity: Minor
      Found in lib/wow/package_resolver.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 glob_packages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def glob_packages
          packages = {}
          Dir.chdir @dir.lib do
            Dir.glob('*').each do |folder|
              next unless File.directory?(folder)
      Severity: Minor
      Found in lib/wow/source/installed.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 extract_all has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def extract_all(destination)
            return false if tar_reader.nil?
            tar_reader.each do |tar_entity|
              destination_file = File.join destination, tar_entity.full_name
              if tar_entity.directory?
      Severity: Minor
      Found in lib/wow/archive.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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def initialize(content = nil)
          @children = []
          unless content.is_a? Hash
            @name = content
            return
      Severity: Minor
      Found in lib/struct/tree.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 list_packages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def list_packages(package_name, version_range = nil, prerelease: false)
          found = []
          version_range = Wow::Package::VersionRange.parse(version_range)
          glob_packages.each do |n, pkg|
            next if n.name != package_name
      Severity: Minor
      Found in lib/wow/source/local.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

      Avoid too many return statements within this method.
      Open

          return include_upper_bound? if version == upper_bound
      Severity: Major
      Found in lib/wow/package/version_range.rb - About 30 mins to fix

        Method file_map has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def file_map(dir = nil)
            results = {}
            glob(dir).each do |file|
              path = root.blank? ? file : File.join(@root, file)
              results[path] = @destination.nil? ? path : File.join(@destination, file)
        Severity: Minor
        Found in lib/wow/package/file_pattern.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 from_folder_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.from_folder_name(folder)
            segments = folder.split('-')
            fail ArgumentError 'Name is wrong should be <name>-<version>' if segments.size < 2
            name = segments[0]
            version = Wow::Package::Version.parse(segments[1])
        Severity: Minor
        Found in lib/wow/package/name_tuple.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