ayemos/lamma

View on GitHub

Showing 9 of 19 total issues

Method prebuild has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def prebuild
      if @prebuild
        Lamma.logger.info 'Running prebuild script...'
        raise unless system(@prebuild)
      elsif [Lamma::Runtime::PYTHON_27, Lamma::Runtime::PYTHON_36].include?(@function.runtime.type) \
Severity: Minor
Found in lib/lamma/code.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 run has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def run
      if Dir.exist?(target)
        Lamma.logger.fatal "Directory '#{target}' already exists."
        exit(1)
      end
Severity: Minor
Found in lib/lamma/cli/init.rb - About 1 hr to fix

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

        def run
          unless File.exist?(@conf_path)
            abort("Config file #{@conf_path} is missing.")
          end
    
    
    Severity: Minor
    Found in lib/lamma/cli/rollback.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 create_initial_role has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def create_initial_role(role_name)
          begin
            Lamma.logger.info("Creating role #{role_name}")
            resp = iam.create_role({
              assume_role_policy_document: DEFAULT_LAMBDA_ASSUME_ROLE_POLICY.to_json,
    Severity: Minor
    Found in lib/lamma/cli/init.rb - About 1 hr to fix

      Method run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def run
            if Dir.exist?(target)
              Lamma.logger.fatal "Directory '#{target}' already exists."
              exit(1)
            end
      Severity: Minor
      Found in lib/lamma/cli/init.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 run has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def run
            unless File.exist?(@conf_path)
              abort("Config file #{@conf_path} is missing.")
            end
      
      
      Severity: Minor
      Found in lib/lamma/cli/rollback.rb - About 1 hr to fix

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

            def zip_and_save
              io = Zip::OutputStream.write_buffer do |zio|
                active_paths.each do |path|
                  next unless File.file?(path)
                  File.open(path) do |source_io|
        Severity: Minor
        Found in lib/lamma/code.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 update_or_create_alias has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def update_or_create_alias(f, new_version)
              a = Lamma::Alias.new(f, options['alias'], new_version)
        
              if a.remote_exist? && a.remote_version
                last_version = a.remote_version
        Severity: Minor
        Found in lib/lamma/cli/deploy.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 create_initial_role has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def create_initial_role(role_name)
              begin
                Lamma.logger.info("Creating role #{role_name}")
                resp = iam.create_role({
                  assume_role_policy_document: DEFAULT_LAMBDA_ASSUME_ROLE_POLICY.to_json,
        Severity: Minor
        Found in lib/lamma/cli/init.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