timcolonel/wow

View on GitHub

Showing 15 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

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

          def platform_based_on?(parent, child)
            parent = parent.platform if parent.is_a? Wow::Package::Target
            child = child.platform if child.is_a? Wow::Package::Target
      
            parent_tree = Wow::Package::Target.platforms.find(parent)
      Severity: Minor
      Found in lib/wow/package/target.rb and 1 other location - About 45 mins to fix
      lib/wow/package/target.rb on lines 132..139

      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 39.

      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 architecture_base_on?(parent, child)
            parent = parent.architecture if parent.is_a? Wow::Package::Target
            child = child.architecture if child.is_a? Wow::Package::Target
      
            parent_tree = Wow::Package::Target.architectures.find(parent)
      Severity: Minor
      Found in lib/wow/package/target.rb and 1 other location - About 45 mins to fix
      lib/wow/package/target.rb on lines 122..129

      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 39.

      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

      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

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

                begin
                  pkg = Wow::Package.new(File.expand_path(file), self)
                  tuple = pkg.spec.name_tuple
                  packages[tuple] = pkg
                rescue SystemCallError
        Severity: Minor
        Found in lib/wow/source/local.rb and 1 other location - About 15 mins to fix
        lib/wow/source/installed.rb on lines 19..24

        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

                begin
                  pkg = Wow::Package.new(File.expand_path(folder), self)
                  tuple = pkg.spec.name_tuple
                  packages[tuple] = pkg
                rescue SystemCallError
        Severity: Minor
        Found in lib/wow/source/installed.rb and 1 other location - About 15 mins to fix
        lib/wow/source/local.rb on lines 36..41

        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

        Severity
        Category
        Status
        Source
        Language