3scale/porta

View on GitHub

Showing 5,205 of 5,561 total issues

Class SimpleLayout has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

class SimpleLayout
 
attr_reader :provider
 
def initialize(provider)
Severity: Minor
Found in app/lib/simple_layout.rb - About 2 hrs to fix

    Class ApplicationsController has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class DeveloperPortal::Admin::ApplicationsController < ::DeveloperPortal::BaseController
    self.responder = ThreeScale::Api::Responder
     
    include Liquid::TemplateSupport
     
     

      Class Service has 21 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Service < Drops::Model
       
      allowed_name :service
       
      def initialize(service, opts = {})
      Severity: Minor
      Found in lib/developer_portal/lib/liquid/drops/service.rb - About 2 hrs to fix

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

        if (($("#fields_definition_required").size() != 0 ) &&
        ($("#fields_definition_required")[0].checked)){
        $("#fields_definition_hidden")[0].checked=false;
        $("#fields_definition_read_only")[0].checked=false;
        $("#fields_definition_hidden").attr('disabled',true);
        Severity: Major
        Found in app/assets/javascripts/application.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/application.js on lines 122..131

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

        if ($("#fields_definition_required")[0].checked){
        $("#fields_definition_hidden")[0].checked=false;
        $("#fields_definition_read_only")[0].checked=false;
        $("#fields_definition_hidden").attr('disabled',true);
        $("#fields_definition_read_only").attr('disabled',true);
        Severity: Major
        Found in app/assets/javascripts/application.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/application.js on lines 98..104

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

        def self.up
        create_table :contracts do |t|
        t.column :id, :int, :null => false, :autoincrement => true
        #the provider
        Severity: Minor
        Found in db/migrate/011_create_contracts.rb - About 1 hr to fix

          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

                    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

                    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

                    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 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 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 toolbar_props has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          def toolbar_props # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
                          if (plan_id = search.plan_id) && (plan = ServicePlan.find(plan_id))
                          plan_name = plan.name
                          plan_service = plan.service.name
                          end
                          Severity: Minor
                          Found in app/presenters/buyers/service_contracts_index_presenter.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
                                Severity
                                Category
                                Status
                                Source
                                Language