rambler-digital-solutions/Generamba

View on GitHub

Showing 28 of 840 total issues

Method setup has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    def setup
      properties = {}

      setup_username_command = Generamba::CLI::SetupUsernameCommand.new
      setup_username_command.setup_username
Severity: Minor
Found in lib/generamba/cli/setup_command.rb - About 5 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 setup has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def setup
      properties = {}

      setup_username_command = Generamba::CLI::SetupUsernameCommand.new
      setup_username_command.setup_username
Severity: Major
Found in lib/generamba/cli/setup_command.rb - About 3 hrs to fix

    Method retrieve_group_or_create_if_needed has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.retrieve_group_or_create_if_needed(group_path, dir_path, file_group_path, project, create_group_if_not_exists, group_is_logical = false)
          group_names = path_names_from_path(group_path)
          group_components_count = group_names.count
          group_names += path_names_from_path(file_group_path) if file_group_path
    
    
    Severity: Minor
    Found in lib/generamba/helpers/xcodeproj_helper.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 process_files_if_needed has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

            def process_files_if_needed(files, code_module, template, project, targets, group_path, dir_path, root_path, processed_groups = [])
                # It's possible that current project doesn't test targets configured, so it doesn't need to generate tests.
                # The same is for files property - a template can have only test or project files
                if targets.count == 0 || files == nil || files.count == 0 || dir_path == nil || group_path == nil
                    return
    Severity: Minor
    Found in lib/generamba/module_generator.rb - About 2 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 generate_module has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

            def generate_module(name, code_module, template)
                # Setting up Xcode objects
                project = XcodeprojHelper.obtain_project(code_module.xcodeproj_path)
    
                # Configuring file paths
    Severity: Minor
    Found in lib/generamba/module_generator.rb - About 2 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 initialize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(name, rambafile, options)
          # Base initialization
          @name = name
          @description = options[:description] ? options[:description] : "#{name} module"
          @author = rambafile[AUTHOR_NAME_KEY] ? rambafile[AUTHOR_NAME_KEY] : UserPreferences.obtain_username
    Severity: Minor
    Found in lib/generamba/code_generation/code_module.rb - About 2 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 setup_file_and_group_paths has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def setup_file_and_group_paths(file_path, group_path, path_type)
          if file_path || group_path
            variable_name = "#{path_type}_file_path"
    
            if file_path || !instance_variable_get("@#{variable_name}")
    Severity: Minor
    Found in lib/generamba/code_generation/code_module.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 generate_module has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def generate_module(name, code_module, template)
                # Setting up Xcode objects
                project = XcodeprojHelper.obtain_project(code_module.xcodeproj_path)
    
                # Configuring file paths
    Severity: Minor
    Found in lib/generamba/module_generator.rb - About 1 hr to fix

      Method process_files_if_needed has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def process_files_if_needed(files, code_module, template, project, targets, group_path, dir_path, root_path, processed_groups = [])
                  # It's possible that current project doesn't test targets configured, so it doesn't need to generate tests.
                  # The same is for files property - a template can have only test or project files
                  if targets.count == 0 || files == nil || files.count == 0 || dir_path == nil || group_path == nil
                      return
      Severity: Minor
      Found in lib/generamba/module_generator.rb - About 1 hr to fix

        Method install_template has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def install_template(template_declaration)
              template_name = template_declaration.name
              puts("Installing #{template_name}...")
        
              template_name = template_declaration.name
        Severity: Minor
        Found in lib/generamba/template/installer/catalog_installer.rb - About 1 hr to fix

          Method gen has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def gen(module_name, template_name)
                does_rambafile_exist = Dir[RAMBAFILE_NAME].count > 0
          
                unless does_rambafile_exist
                  puts('Rambafile not found! Run `generamba setup` in the working directory instead!'.red)
          Severity: Minor
          Found in lib/generamba/cli/gen_command.rb - About 1 hr to fix

            Method initialize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def initialize(name, rambafile, options)
                  # Base initialization
                  @name = name
                  @description = options[:description] ? options[:description] : "#{name} module"
                  @author = rambafile[AUTHOR_NAME_KEY] ? rambafile[AUTHOR_NAME_KEY] : UserPreferences.obtain_username
            Severity: Minor
            Found in lib/generamba/code_generation/code_module.rb - About 1 hr to fix

              Method process_files_if_needed has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      def process_files_if_needed(files, code_module, template, project, targets, group_path, dir_path, root_path, processed_groups = [])
              Severity: Major
              Found in lib/generamba/module_generator.rb - About 1 hr to fix

                Method install_template has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def install_template(template_declaration)
                      template_name = template_declaration.name
                      puts("Installing #{template_name}...")
                
                      repo_url = template_declaration.git
                Severity: Minor
                Found in lib/generamba/template/installer/remote_installer.rb - About 1 hr to fix

                  Method add_file_to_project_and_targets has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def self.add_file_to_project_and_targets(project, targets_name, group_path, dir_path, file_group_path, file_name, root_path, file_is_resource = false)
                  Severity: Major
                  Found in lib/generamba/helpers/xcodeproj_helper.rb - About 1 hr to fix

                    Method add_file_to_project_and_targets has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def self.add_file_to_project_and_targets(project, targets_name, group_path, dir_path, file_group_path, file_name, root_path, file_is_resource = false)
                          
                          if root_path
                              file_path = root_path
                          else
                    Severity: Minor
                    Found in lib/generamba/helpers/xcodeproj_helper.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 remove_file_from_build_phases has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def self.remove_file_from_build_phases(file_path, build_phases)
                          return if build_phases.nil?
                    
                          build_phases.each do |build_phase|
                            build_phase.files.each do |build_file|
                    Severity: Minor
                    Found in lib/generamba/helpers/xcodeproj_helper.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 retrieve_group_or_create_if_needed has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def self.retrieve_group_or_create_if_needed(group_path, dir_path, file_group_path, project, create_group_if_not_exists, group_is_logical = false)
                    Severity: Minor
                    Found in lib/generamba/helpers/xcodeproj_helper.rb - About 45 mins to fix

                      Method prepare_parameters_for_displaying has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def self.prepare_parameters_for_displaying(code_module, template_name)
                            params = {}
                      
                            params['Targets'] = code_module.project_targets.join(',') if code_module.project_targets
                            params['Module path'] = code_module.project_file_path if code_module.project_file_path
                      Severity: Minor
                      Found in lib/generamba/helpers/gen_command_table_parameters_formatter.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 setup_username has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def setup_username
                              username = Generamba::UserPreferences.obtain_username
                              unless username
                                puts('The author name is not configured!'.red)
                                git_username = Git.init.config['user.name']
                      Severity: Minor
                      Found in lib/generamba/cli/setup_username_command.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

                      Severity
                      Category
                      Status
                      Source
                      Language