3scale/porta

View on GitHub

Showing 308 of 5,717 total issues

Class Account has 43 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Account < Drops::Model

      info %{
A developer account. See `User` drop if you are looking for the email addresses or similar information.
      }
Severity: Minor
Found in lib/developer_portal/lib/liquid/drops/account.rb - About 5 hrs to fix

    File account.rb has 403 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Account < ApplicationRecord
      attribute :credit_card_expires_on, :date
      self.ignored_columns = %i[proxy_configs_file_name proxy_configs_content_type proxy_configs_file_size
                                proxy_configs_updated_at proxy_configs_conf_file_name proxy_configs_conf_content_type
                                proxy_configs_conf_file_size proxy_configs_conf_updated_at]
    Severity: Minor
    Found in app/models/account.rb - About 5 hrs to fix

      Method error_messages_for has a Cognitive Complexity of 37 (exceeds 5 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 5 hrs 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

      File 20100125103539_browser_cms_tables.rb has 398 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class BrowserCmsTables < ActiveRecord::Migration
        def self.up
          create_table "attachment_versions", :force => true do |t|
            t.integer  "attachment_id"
            t.integer  "version"
      Severity: Minor
      Found in db/migrate/20100125103539_browser_cms_tables.rb - About 5 hrs to fix

        File user.rb has 389 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'digest/sha1'
        
        class User < ApplicationRecord
          include Symbolize
        
        
        Severity: Minor
        Found in app/models/user.rb - About 5 hrs to fix

          Class Application has 40 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class Application < Drops::Contract
                drop_example "Using application drop in liquid.", %{
                  <h1>Application {{ application.name }} (<span title="Application ID">{{ application.application_id }}</span>)</h1>
                  <p>{{ application.description }}</p>
                }
          Severity: Minor
          Found in lib/developer_portal/lib/liquid/drops/application.rb - About 5 hrs to fix

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

                def self.up
                  create_table :blogs do |t|
                    t.string :name
                    t.string :format
                    t.text :template
            Severity: Major
            Found in db/migrate/20100216080646_cms_blog.rb - About 5 hrs to fix

              Class BillingStrategy has 37 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Finance::BillingStrategy < ApplicationRecord
                module NonAuditedColumns
                  def non_audited_columns
                    super - [inheritance_column]
                  end
              Severity: Minor
              Found in app/models/finance/billing_strategy.rb - About 4 hrs to fix

                Method charge! has a Cognitive Complexity of 32 (exceeds 5 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 4 hrs 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 clause has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                Open

                      def clause(*args)
                        model    = (args.length >= 2 ? args[0] : nil)
                        is_delta = (args.length >= 2 ? args[1] : args[0]) || false
                
                        table_name  = (model.nil? ? adapter.quoted_table_name   : model.quoted_table_name)
                Severity: Minor
                Found in config/initializers/oracle.rb - About 4 hrs 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

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

                class NotificationMailer < ActionMailer::Base
                  default from: Rails.configuration.three_scale.notification_email
                
                  layout 'notification_email'
                
                
                Severity: Minor
                Found in app/mailers/notification_mailer.rb - About 4 hrs to fix

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

                    def self.down
                      create_table "credit_transactions", :force => true do |t|
                        t.integer  "account_id"
                        t.string   "kind",                                                 :default => "incoming"
                        t.string   "currency",                                             :default => "EUR",      :null => false
                  Severity: Major
                  Found in db/migrate/20111128090920_dumping_unused_tables.rb - About 4 hrs to fix

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

                        def to_xml(options = {})
                          xml = options[:builder] || ThreeScale::XML::Builder.new
                    
                          xml.status do |xml|
                            xml.plan(plan_name) if plan_name
                    Severity: Minor
                    Found in app/models/backend/status.rb - About 4 hrs 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

                    Class Urls has 33 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        class Urls < Drops::Base
                          allowed_name :urls
                    
                          attr_reader :provider
                          protected :provider
                    Severity: Minor
                    Found in lib/developer_portal/lib/liquid/drops/urls.rb - About 4 hrs to fix

                      File cinstance.rb has 339 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      class Cinstance < Contract
                        include SaveDestroyForServiceAssociation
                        # Maximum number of cinstances permitted between provider and buyer
                        MAX = 10
                      
                      
                      Severity: Minor
                      Found in app/models/cinstance.rb - About 4 hrs to fix

                        Method to_xml has a Cognitive Complexity of 28 (exceeds 5 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 4 hrs 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

                        Class Metric has 32 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Metric < ApplicationRecord
                          include Backend::ModelExtensions::Metric
                          include SystemName
                          include BackendApiLogic::MetricExtension
                          include Searchable
                        Severity: Minor
                        Found in app/models/metric.rb - About 4 hrs to fix

                          File notification_mailer.rb has 321 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          class NotificationMailer < ActionMailer::Base
                            default from: Rails.configuration.three_scale.notification_email
                          
                            layout 'notification_email'
                          
                          
                          Severity: Minor
                          Found in app/mailers/notification_mailer.rb - About 3 hrs to fix

                            File plan.rb has 317 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            class Plan < ApplicationRecord
                              include Searchable
                              class PeriodRangeCalculationError < StandardError; end
                              include Symbolize
                            
                            
                            Severity: Minor
                            Found in app/models/plan.rb - About 3 hrs to fix

                              Class EmailTemplate has 28 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              class CMS::EmailTemplate < CMS::Template
                              
                                validates :system_name, presence: true
                                validates :current, presence: true
                                validates :system_name, uniqueness: { scope: %i[provider_id], allow_blank: true, case_sensitive: true }
                              Severity: Minor
                              Found in app/models/cms/email_template.rb - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language