tryzealot/zealot

View on GitHub

Showing 53 of 53 total issues

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

class Release < ApplicationRecord
  extend VersionCompare

  include ReleaseUrl
  include ReleaseAuth
Severity: Minor
Found in app/models/release.rb - About 4 hrs to fix

    Class Manager has 24 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 not_found has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        def not_found(e)
          @e = e
          @title = t('releases.messages.errors.not_found')
          @link_title = t('releases.messages.errors.redirect_to_app_list')
          @link_href = apps_path
      Severity: Minor
      Found in app/controllers/releases_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 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 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 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 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

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

            renderUnsupport() {
              this.button.addClass("btn-warning")
                .removeClass("btn-primary")
          
              this.button.find("i")
          Severity: Major
          Found in app/javascript/controllers/clipboard_center_controller.js and 1 other location - About 1 hr to fix
          app/javascript/controllers/clipboard_center_controller.js on lines 29..36

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

          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

            renderSuccess() {
              this.button.addClass("btn-success")
                .removeClass("btn-primary")
          
              this.button.find("i")
          Severity: Major
          Found in app/javascript/controllers/clipboard_center_controller.js and 1 other location - About 1 hr to fix
          app/javascript/controllers/clipboard_center_controller.js on lines 20..27

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

          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 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 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 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 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 display_value has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def display_value(key, value)
                        case value
                        when Hash
                          value.blank? ? t('admin.settings.empty_value') : pretty_json(value)
                        when Array
                  Severity: Minor
                  Found in app/helpers/admin/setting_helper.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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language