ptomulik/puppet-macro

View on GitHub

Showing 5 of 5 total issues

Method call_macro has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def call_macro(scope, name, args, options = {}, env = default_environment)
Severity: Minor
Found in lib/puppet/macros.rb - About 35 mins to fix

    Method call_macro_from_func has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def call_macro_from_func(scope, func_name, func_args, n = 0, env = default_environment)
    Severity: Minor
    Found in lib/puppet/macros.rb - About 35 mins to fix

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

        def to_lambda(block)
          if Puppet::Util::Package.versioncmp(RUBY_VERSION,"1.9") >=0 
            unless block.lambda?
              # This code is based on: https://github.com/schneems/proc_to_lambda
              # See also https://github.com/schneems/proc_to_lambda/issues/1
      Severity: Minor
      Found in lib/puppet/macros.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 check_macro_arity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def check_macro_arity(macro, macro_args, errclass = ArgumentError)
          min_arity, max_arity = macro_arities(macro)
          argn = macro_args.size
          if min_arity == max_arity
            if argn != min_arity
      Severity: Minor
      Found in lib/puppet/macros.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 autoloader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def autoloader
            unless @autoloader
              # Patched autoloader whith 'loadall' searching recursivelly
              @autoloader = Puppet::Util::Autoload.new(
                self, "puppet/macros", :wrap => false
      Severity: Minor
      Found in lib/puppet/macros.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