ayemos/lamma

View on GitHub
lib/lamma/cli/init.rb

Summary

Maintainability
B
4 hrs
Test Coverage

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

      unexpected token tCOLON (Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
      Open

                  'Effect': 'Allow',
      Severity: Minor
      Found in lib/lamma/cli/init.rb by rubocop

      unexpected token tCOLON (Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
      Open

              'Version': '2012-10-17',
      Severity: Minor
      Found in lib/lamma/cli/init.rb by rubocop

      There are no issues that match your filters.

      Category
      Status