3scale/porta

View on GitHub

Showing 5,200 of 5,560 total issues

Method get_token has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def get_token(args)
getHostedProfilePageRequest = <<~EOR
<?xml version="1.0" encoding="utf-8"?>
<getHostedProfilePageRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
Severity: Minor
Found in app/lib/payment_gateways/authorize_net_cim_crypt.rb - About 1 hr to fix

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

    $.fn.disableSwitch = function() {
    var context = this;
     
    context.find(".enabled_block").fadeOut(function() {
    context.find(".disabled_block").fadeIn();
    lib/developer_portal/app/assets/javascripts/essential_assets/switch.js on lines 3..9

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

    $.fn.enableSwitch = function() {
    var context = this;
     
    context.find(".disabled_block").fadeOut(function() {
    context.find(".enabled_block").fadeIn();
    lib/developer_portal/app/assets/javascripts/essential_assets/switch.js on lines 11..17

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

    def update
    forced_parameters = :credit_card_token, :account_id, :billing_address_name, :billing_address_address,
    :billing_address_city, :billing_address_country, :credit_card_expiration_year,
    :credit_card_expiration_month
     
     
    Severity: Minor
    Found in app/controllers/admin/api/credit_cards_controller.rb - About 1 hr to fix

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

      def self.up
      drop_table :account_group_memberships
      drop_table :app_exhibits
      drop_table :assets
      drop_table :attachment_versions
      Severity: Minor
      Found in db/migrate/20121018100514_removing_bcms_tables.rb - About 1 hr to fix

        Method template_source has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def template_source
        sender = @_message.sender
         
        # if provider sends message to buyer, source is provider
        # try - rpovider is sender, reciever is master
        Severity: Minor
        Found in app/lib/messenger/base.rb - About 1 hr to fix

        Method extra_fields_to_xml has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def extra_fields_to_xml(xml)
        xml.extra_fields do
        if extra_fields.present?
        extra_fields.each_pair do |field, value|
        if extra_field?(field) && value.present?
        Severity: Minor
        Found in app/lib/fields/extra_fields.rb - About 1 hr to fix

        Method to_xml has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def to_xml(options = {})
        options = options.dup
        options[:root] ||= all? { |e| e.is_a?(first.class) && first.class.to_s != "Hash" } ? first.class.to_s.underscore.pluralize.tr('/', '-') : "records"
        options[:builder] ||= ThreeScale::XML::Builder.new
        options[:skip_types] = true unless options.has_key?(:skip_types)
        Severity: Minor
        Found in config/initializers/array_hacks.rb - About 1 hr to fix

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

        def self.down
        remove_column :accounts, :tenant_id
        remove_column :alerts, :tenant_id
        remove_column :app_exhibits, :tenant_id
        remove_column :assets, :tenant_id
        Severity: Minor
        Found in db/migrate/20111213150651_add_tenant_id_columns.rb - About 1 hr to fix

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

          def self.up
          add_column :accounts, :tenant_id, :integer
          add_column :alerts, :tenant_id, :integer
          add_column :app_exhibits, :tenant_id, :integer
          add_column :assets, :tenant_id, :integer
          Severity: Minor
          Found in db/migrate/20111213150651_add_tenant_id_columns.rb - About 1 hr to fix

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

            def message_notification(message, recipient)
            unless recipient
            Rails.logger.error "Can't notify null recipient for message #{message.id}"
            return
            end
            Severity: Minor
            Found in app/mailers/post_office.rb - About 1 hr to fix

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

              def self.down
              create_table "releases", :force => true do |t|
              t.string "name"
              t.string "version"
              t.text "notes"
              Severity: Minor
              Found in db/migrate/20111129153645_dropping_releases.rb - About 1 hr to fix

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

                def to_xml(options = {})
                #TODO: use Nokogiri builder
                xml = options[:builder] || ThreeScale::XML::Builder.new
                 
                xml.account do |xml|
                Severity: Minor
                Found in app/models/account.rb - About 1 hr to fix

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

                  def error_messages_for(*params)
                  ignore_me = ['Account is invalid', 'Bought cinstances is invalid']
                  options = params.extract_options!.symbolize_keys
                   
                  objects = if object = options.delete(:object)
                  Severity: Minor
                  Found in app/helpers/application_helper.rb - About 1 hr to fix

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

                    def self.down
                    remove_column :account_group_memberships, :tenant_id
                    remove_column :attachment_versions, :tenant_id
                    remove_column :attachments, :tenant_id
                    remove_column :blog_comment_versions, :tenant_id
                    Severity: Minor
                    Found in db/migrate/20120109161319_add_tenant_id_to_bcms_tables.rb - About 1 hr to fix

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

                      def self.down
                      create_table "stream_versions", :force => true do |t|
                      t.integer "stream_id"
                      t.integer "version"
                      t.string "name"
                      Severity: Minor
                      Found in db/migrate/20120109151500_remove_streams.rb - About 1 hr to fix

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

                        def self.up
                        create_table :news_articles do |t|
                        t.string :name
                        t.string :slug
                        t.datetime :release_date
                        Severity: Minor
                        Found in db/migrate/20100216080656_cms_news.rb - About 1 hr to fix

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

                          def self.up
                          add_column :account_group_memberships, :tenant_id, :integer
                          add_column :attachment_versions, :tenant_id, :integer
                          add_column :attachments, :tenant_id, :integer
                          add_column :blog_comment_versions, :tenant_id, :integer
                          Severity: Minor
                          Found in db/migrate/20120109161319_add_tenant_id_to_bcms_tables.rb - About 1 hr to fix

                            Method props has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            def props # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
                            {
                            activeDocs: api_docs_services.map do |api_doc| # rubocop:disable Metrics/BlockLength
                            {
                            id: api_doc.id,
                            Severity: Minor
                            Found in app/presenters/provider/admin/api_docs_index_presenter.rb - About 1 hr to fix

                              Method freeze_closed_invoices_raw has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              def self.freeze_closed_invoices_raw
                              vat_rate_cmd = "UPDATE invoices i LEFT JOIN accounts buyer ON i.buyer_account_id = buyer.id SET i.vat_rate = buyer.vat_rate;"
                               
                              address_cmd = """
                              UPDATE invoices i
                              Severity: Minor
                              Found in lib/migration/finance.rb - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language