ntnn/puppetfiler

View on GitHub

Showing 13 of 13 total issues

Method fixture has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

        def self.fixture(modules, repos, modifiers = {})
            fixtures = {}

            %w{forge_modules repositories}.each do |k|
                modifiers[k] = {} if not modifiers.has_key?(k)
Severity: Minor
Found in lib/puppetfiler/fixture.rb - About 3 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 fixture has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def self.fixture(modules, repos, modifiers = {})
            fixtures = {}

            %w{forge_modules repositories}.each do |k|
                modifiers[k] = {} if not modifiers.has_key?(k)
Severity: Minor
Found in lib/puppetfiler/fixture.rb - About 1 hr to fix

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

            def check
                t = [nil, nil]
                %i{puppetfile metadata}.each do |m|
                    if not options[m].nil?
                        t = [m, options[m]]
    Severity: Minor
    Found in lib/puppetfiler/cli.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 mod has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

            def mod(name, *args)
                arg = args[0]
    
                if arg.is_a?(String)
                    return if arg == 'latest'
    Severity: Minor
    Found in lib/puppetfiler/puppetfile.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 detect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.detect(type = nil, target = nil)
            if (type.nil? && !target.nil?) || (!type.nil? && target.nil?)
                fail 'Type and target are required to bet both set'
            elsif !type.nil? && !target.nil?
                return type, target
    Severity: Minor
    Found in lib/puppetfiler.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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            def initialize(*args)
                require 'hashie'
                args = Hashie.symbolize_keys(args[0])
    
                raise "Names with dashes are disallowed: #{args[:name]}" if /-/.match(args[:name])
    Severity: Minor
    Found in lib/puppetfiler/mod.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 eql? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            def eql?(other)
                return false if not @name.eql?(other.name)
    
                # range has to be checked first, sine version is a method
                # returning at least latest
    Severity: Minor
    Found in lib/puppetfiler/mod.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 false
    Severity: Major
    Found in lib/puppetfiler/mod.rb - About 30 mins to fix

      TODO found
      Open

                  # TODO configurable timeout
      Severity: Minor
      Found in lib/puppetfiler/puppetfile.rb by fixme

      TODO found
      Open

                      # TODO support local(?)
      Severity: Minor
      Found in lib/puppetfiler/puppetfile.rb by fixme

      TODO found
      Open

                      # TODO similar to Metadata, allow IO objects like File,
      Severity: Minor
      Found in lib/puppetfiler/puppetfile.rb by fixme

      TODO found
      Open

                      # TODO support fallbacks, e.g. using the rugged provider
      Severity: Minor
      Found in lib/puppetfiler/puppetfile.rb by fixme

      TODO found
      Open

                          # TODO use x.match?(y) on ruby 2.4
      Severity: Minor
      Found in lib/puppetfiler/fixture.rb by fixme
      Severity
      Category
      Status
      Source
      Language