BigKeeper/big-keeper

View on GitHub

Showing 109 of 109 total issues

Method generate_module_config has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def generate_module_config(line, module_name, module_operate_type)
      line.sub(/(\s*)pod(\s*)('|")#{module_name}((\/[_a-zA-Z0-9]+)?)('|")([\s\S]*)/){
        if ModuleOperateType::ADD == module_operate_type
          module_path = BigkeeperParser.module_path(@user, module_name)
          "#{$1}pod '#{module_name}#{$4}', :path => '#{module_path}'"
Severity: Minor
Found in lib/big_keeper/dependency/dep_pod_operator.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 get_unlock_pod_list has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

     def get_unlock_pod_list(is_all)
       result = {}
       pod_parser = PodfileParser.instance
       #podfile 中 unlock pods
       unlock_pods = pod_parser.get_unlock_pod_list
Severity: Minor
Found in lib/big_keeper/util/lockfile_parser.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 podspec_change has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def podspec_change(podspec_file, version, module_name)
      temp_file = Tempfile.new(".#{module_name}.podspec", :encoding => 'UTF-8')
      has_change = false
      begin
        File.open(podspec_file, 'r', :encoding => 'UTF-8') do |file|
Severity: Minor
Found in lib/big_keeper/util/podfile_operator.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 parse has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def parse(main_path)
      self.main_path = main_path
      $mode = 'PODS'
      podfile_lock_lines = File.readlines("#{main_path}/Podfile.lock", :encoding => 'UTF-8')
      Logger.highlight("Analyzing Podfile.lock...")
Severity: Minor
Found in lib/big_keeper/util/lockfile_parser.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 update_module_version_name has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def update_module_version_name(build_file, version_name)
      temp_file = Tempfile.new('.build.gradle.tmp')
      isModifyPom = false
      isBigkeeperScript = false
      isBigkeeperBackupScript = false
Severity: Minor
Found in lib/big_keeper/util/gradle_file_operator.rb - About 1 hr to fix

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

      def deal_podfile_line(sentence)
        return unless !sentence.strip.start_with?("#")
        if sentence.strip.include?('pod ')
          pod_model = PodfileModel.new(sentence)
          if !pod_model.name.empty? &&
    Severity: Minor
    Found in lib/big_keeper/util/podfile_detector.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 verify_rebase has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def verify_rebase(path, branch_name, name)
    
          # pull rebased branch
          pull(path, branch_name)
    
    
    Severity: Minor
    Found in lib/big_keeper/service/git_service.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 to_json has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.to_json(home_branches, module_info_list, version)
          json_array = []
          print_all = version == "all versions"
          home_branches = home_branches.uniq
          home_branches.each do | home_branch_name |
    Severity: Minor
    Found in lib/big_keeper/util/list_generator.rb - About 1 hr to fix

      Method client_command has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.client_command
          desc 'API for bigkeeper-client.'
          command :client do | c |
            c.desc 'Commands about operate modules.'
            c.command :modules do |modules|
      Severity: Minor
      Found in lib/big_keeper/command/client.rb - About 1 hr to fix

        Method pod_command has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.pod_command
            desc 'Podfile operation'
            command :podfile do |podfile|
              podfile.desc 'Podfile'
        
        
        Severity: Minor
        Found in lib/big_keeper/command/pod.rb - About 1 hr to fix

          Method update_module_build has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def update_module_build(build_file, module_name, depend_modules, version_name)
                module_full_path = BigkeeperParser.module_full_path(@path, @user, module_name)
                cache_path = File.expand_path("#{module_full_path}/.bigkeeper")
                big_build_file = "#{cache_path}/bigkeeper_build.gradle"
          
          
          Severity: Minor
          Found in lib/big_keeper/util/gradle_file_operator.rb - About 1 hr to fix

            Method update_module_settings has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def update_module_settings(module_name, settings_file, depend_modules)
                  module_full_path = BigkeeperParser.module_full_path(@path, @user, module_name)
                  cache_path = File.expand_path("#{module_full_path}/.bigkeeper")
                  big_settings_file = "#{cache_path}/bigkeeper_settings.gradle"
            
            
            Severity: Minor
            Found in lib/big_keeper/util/gradle_file_operator.rb - About 1 hr to fix

              Method update_home_settings has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def update_home_settings(settings_file, depend_modules)
                    cache_path = File.expand_path("#{@path}/.bigkeeper")
                    big_settings_file = "#{cache_path}/bigkeeper_settings.gradle"
              
                    if depend_modules.empty? && !File.exist?(big_settings_file)
              Severity: Minor
              Found in lib/big_keeper/util/gradle_file_operator.rb - About 1 hr to fix

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

                    def update_home_build(build_file, depend_modules, version_name)
                      cache_path = File.expand_path("#{@path}/.bigkeeper")
                      big_build_file = "#{cache_path}/bigkeeper_build.gradle"
                
                      if depend_modules.empty? && !File.exist?(big_build_file)
                Severity: Minor
                Found in lib/big_keeper/util/gradle_file_operator.rb - About 1 hr to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          m.command :finish do |finish|
                            finish.action do |global_options, options, args|
                              path = File.expand_path(global_options[:path])
                              version = global_options[:ver]
                              user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
                  Severity: Major
                  Found in lib/big_keeper/command/release.rb and 1 other location - About 1 hr to fix
                  lib/big_keeper/command/release.rb on lines 68..78

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 59.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          m.command :start do |start|
                            start.action do |global_options, options, args|
                              path = File.expand_path(global_options[:path])
                              version = global_options[:ver]
                              user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
                  Severity: Major
                  Found in lib/big_keeper/command/release.rb and 1 other location - About 1 hr to fix
                  lib/big_keeper/command/release.rb on lines 84..94

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 59.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Method generate_module_config has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def generate_module_config(line, module_name, module_operate_type)
                        line.sub(/(\s*)pod(\s*)('|")#{module_name}((\/[_a-zA-Z0-9]+)?)('|")([\s\S]*)/){
                          if ModuleOperateType::ADD == module_operate_type
                            module_path = BigkeeperParser.module_path(@user, module_name)
                            "#{$1}pod '#{module_name}#{$4}', :path => '#{module_path}'"
                  Severity: Minor
                  Found in lib/big_keeper/dependency/dep_pod_operator.rb - About 1 hr to fix

                    Method get_all_public_file has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def get_all_public_file(path)
                          all_header = FileOperator.find_all_header_file("#{path}/Pods/#{@name}")
                          for file_path in all_header do
                            @header_file_list[@header_file_list.size] = file_path
                            file_name = File.basename(file_path)
                    Severity: Minor
                    Found in lib/big_keeper/model/library_model.rb - About 1 hr to fix

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

                          def self.pod_repo_push(path, module_name, source, version)
                            Logger.highlight(%Q(Start Pod repo push #{module_name}))
                            Dir.chdir(path) do
                              command = ""
                              p BigkeeperParser.source_spec_name(module_name)
                      Severity: Minor
                      Found in lib/big_keeper/util/pod_operator.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 podspec_change has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def podspec_change(podspec_file, version, module_name)
                            temp_file = Tempfile.new(".#{module_name}.podspec", :encoding => 'UTF-8')
                            has_change = false
                            begin
                              File.open(podspec_file, 'r', :encoding => 'UTF-8') do |file|
                      Severity: Minor
                      Found in lib/big_keeper/util/podfile_operator.rb - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language