3scale/porta

View on GitHub

Showing 309 of 5,637 total issues

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

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

    Method freeze_closed_invoices has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.freeze_closed_invoices
          Invoice.reset_column_information
          all = Invoice.count
          count = 0
    
    
    Severity: Minor
    Found in lib/migration/finance.rb - About 1 hr to fix

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

        def to_xml(options = {})
          result = options[:builder] || ThreeScale::XML::Builder.new
      
          result.application do |xml|
            unless new_record?
      Severity: Minor
      Found in app/models/cinstance.rb - About 1 hr to fix

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

          def self.down
            create_table :liquid_pages do |table|
              table.integer :account_id
              table.string  :title
              table.text    :content

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

            def self.up
              pages = LiquidPage.find_all_by_title('layout')
              pages.each do |page|
                puts "Hacking layout of: #{page.account.try!(:org_name)}"
          
          

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

              def self.daily(options = {})
                raise 'Options must be a hash' unless options.is_a?(Hash)
            
                Rails.logger.info("Finance::BillingStrategy.daily started for options #{options}")
            
            
            Severity: Minor
            Found in app/models/finance/billing_strategy.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 create_plan has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

              def create_plan(type, options)
                ActiveSupport::Deprecation.warn '[create_plan] Stop using this method, use factories'
                options[:cost] ||= 0
            
                issuer = options[:issuer]
            Severity: Minor
            Found in features/support/plan_helpers.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 write_audit has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def write_audit(attrs)
                  return unless auditing_enabled
            
                  provider_id = respond_to?(:tenant_id) && self.tenant_id
                  provider_id ||= respond_to?(:provider_account_id) && self.provider_account_id
            Severity: Minor
            Found in config/initializers/audited_hacks.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 charge! has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def charge!(automatic = true)
                ensure_payable_state!
            
                unless chargeable?
                  logger.info "Not charging invoice #{id} (buyer #{buyer_account_id}), reason: #{reason_cannot_charge}"
            Severity: Minor
            Found in app/models/invoice.rb - About 1 hr to fix

              Method usage has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def usage(options)
                      range, granularity, metric = extract_range_and_granularity_and_metric(options)
              
                      data = usage_values_in_range(range, granularity, metric) # metric can be a response_code
              
              
              Severity: Minor
              Found in app/lib/stats/views/usage.rb - About 1 hr to fix

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

                    def initialize(repository = self.class.repository, event_broker = EventBroker.new)
                      @client = ::RailsEventStore::Client.new(repository: repository, event_broker: event_broker)
                      @facade = Facade.new(repository, event_broker)
                
                      @client.subscribe_to_all_events(AfterCommitSubscriber.new)
                Severity: Minor
                Found in app/lib/event_store/repository.rb - About 1 hr to fix

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

                    def self.up
                      execute('INSERT INTO dynamic_views (
                                 version,
                                 type,
                                 name,

                    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

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

                              def create
                                account_params = (params[:account] || {}) .dup
                                user_params    = account_params.try(:delete, :user) || {}
                          
                                if signup_user!(account_params, user_params)

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

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

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

                              def transaction(*objects, &block)
                                retry_count = 0
                          
                                check_innodb_status_available
                          
                          
                          Severity: Minor
                          Found in lib/deadlock_retry.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_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

                          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