tryzealot/zealot

View on GitHub

Showing 40 of 54 total issues

Class Release has 35 methods (exceeds 20 allowed). Consider refactoring.
Open

class Release < ApplicationRecord
  extend ActionView::Helpers::TranslationHelper
  include ActionView::Helpers::TranslationHelper
  include ReleaseUrl
  include ReleaseAuth
Severity: Minor
Found in app/models/release.rb - About 4 hrs to fix

    Class Manager has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Manager
        include Zealot::Backup::Helper
    
        TEMPDIR_PREFIX = 'zealot-backup'
        DEFAULT_BACKUP_PATH = 'public/backup'
    Severity: Minor
    Found in lib/zealot/backup/manager.rb - About 2 hrs to fix

      Method stardford_app has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def stardford_app(user)
          app_name = t('demo.app_name1')
          app_bundle_id = 'com.zealot.app-demo'
          channels = %i[Android iOS]
          schemes = [
      Severity: Major
      Found in app/services/create_sample_apps_service.rb - About 2 hrs to fix

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

          def perform(debug_file, user_id = nil)
            parser = AppInfo.parse(debug_file.file.path)
        
            case parser.format
            when AppInfo::Format::DSYM
        Severity: Minor
        Found in app/jobs/debug_file_teardown_job.rb - About 1 hr to fix

          Method convert_changelog has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def convert_changelog
              if json_string?(changelog)
                self.changelog = JSON.parse(changelog)
              elsif changelog.blank?
                self.changelog = []
          Severity: Minor
          Found in app/models/release.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 set_disk_volumes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def set_disk_volumes
              @disks = Sys::Filesystem.mounts.each_with_object([]) do |mount, obj|
                mount_options = mount.options.split(',').map(&:strip)
                # next if (EXCLUDED_MOUNT_OPTIONS & mount_options).any?
                next if (EXCLUDED_MOUNT_TYPES & [mount.mount_type]).any?
          Severity: Minor
          Found in app/controllers/admin/system_info_controller.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_dsym has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def parse_dsym(debug_file, parser)
              bundle_ids = debug_file.app.bundle_ids
          
              if bundle_ids.present?
                upload_bundle_ids = []
          Severity: Minor
          Found in app/jobs/debug_file_teardown_job.rb - About 1 hr to fix

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

              def process_signature_certs(parser, metadata)
                metadata.developer_certs = parser.signatures.each_with_object([]) do |sign, certs|
                  signature = { scheme: sign[:version] }
                  signature[:verified] = sign[:verified]
                  signature[:certificates] = sign[:certificates]&.each_with_object([]) do |cert, obj|
            Severity: Minor
            Found in app/services/teardown_service.rb - About 1 hr to fix

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

                def update
                  authorize @setting
              
                  @title = t('.title')
                  @value = setting_param[:value]
              Severity: Minor
              Found in app/controllers/admin/settings_controller.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 fetch_icon has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def fetch_icon(parser)
                  file = case parser.platform
                         when AppInfo::Platform::IOS
                          return if parser.icons.blank?
              
              
              Severity: Minor
              Found in app/models/concerns/release_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 register_device has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def register_device(udid, name = nil, platform = 'IOS')
                  if (existed_device = Device.find_by(udid: udid))
                    return existed_device
                  end
              
              
              Severity: Minor
              Found in app/models/apple_key.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 dump has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def dump
                    FileUtils.rm_f(db_file_name)
              
                    compress_rd, compress_wr = IO.pipe
                    compress_pid = spawn(gzip_cmd, in: compress_rd, out: [db_file_name, 'w', 0600])
              Severity: Minor
              Found in lib/zealot/backup/database.rb - About 1 hr to fix

                Function received has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  received(data) {
                    if (Zealot.isDevelopment) {
                      console.debug("Received data", data)
                    }
                
                
                Severity: Minor
                Found in app/javascript/channels/notification_channel.js - About 1 hr to fix

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

                    def register_device(udid, name = nil, platform = 'IOS')
                      if (existed_device = Device.find_by(udid: udid))
                        return existed_device
                      end
                  
                  
                  Severity: Minor
                  Found in app/models/apple_key.rb - About 1 hr to fix

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

                      def release_versions(limit = 10)
                        versions = releases.select(:release_version)
                          .where.not(release_version: nil)
                          .group(:release_version)
                          .map(&:release_version)
                    Severity: Minor
                    Found in app/models/channel.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 remove_old has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def remove_old(max_keeps = nil)
                          logger.debug 'Deleting old backups ... '
                          Dir.chdir(backup_path) do
                            max_keeps ||= Setting.backup[:max_keeps]
                            backup_file_count = backup_file_list.size
                    Severity: Minor
                    Found in lib/zealot/backup/manager.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_dsym has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def parse_dsym(debug_file, parser)
                        bundle_ids = debug_file.app.bundle_ids
                    
                        if bundle_ids.present?
                          upload_bundle_ids = []
                    Severity: Minor
                    Found in app/jobs/debug_file_teardown_job.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

                    Function dialogElement has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      get dialogElement() {
                        const root = document.createElement("div")
                        root.id = DIALOG_ID
                        root.classList.add("modal")
                        root.classList.add("fade")
                    Severity: Minor
                    Found in app/javascript/controllers/destroy_controller.js - About 1 hr to fix

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

                        def process_ios(parser, metadata)
                          process_app_common(parser, metadata)
                          process_mobileprovision(parser.mobileprovision, metadata) if parser.mobileprovision?
                      
                          metadata.bundle_id = parser.bundle_id
                      Severity: Minor
                      Found in app/services/teardown_service.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 recently_release has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def recently_release
                          Rails.cache.fetch(recently_release_cache_key) do
                            return unless schcmes_ids = schemes.select(:id).map(&:id)
                            return unless channel_ids = Channel.select(:id).where(schemes: schcmes_ids).map(&:id)
                            return unless release = Release.where(channels: channel_ids).last
                      Severity: Minor
                      Found in app/models/app.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

                      Severity
                      Category
                      Status
                      Source
                      Language