3scale/porta

View on GitHub

Showing 5,377 of 5,713 total issues

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

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

                  class Report
                    include Printer
                
                    attr_accessor :account, :period, :pdf, :service, :report
                
                
                Severity: Minor
                Found in app/lib/pdf/report.rb - About 3 hrs to fix

                  File billing_strategy.rb has 305 lines of code (exceeds 250 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 3 hrs to fix

                    Method create_builtin_pages_and_partials! has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def create_builtin_pages_and_partials!
                        p = provider.builtin_pages
                    
                        # Shared
                        create_builtin_partial!('field')
                    Severity: Major
                    Found in app/lib/simple_layout.rb - About 3 hrs to fix

                      Class MailPreview has 27 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class MailPreview < MailView
                        FakeContract = Struct.new(:id, :old_plan, :plan, :provider_account, :service, :account, :name)
                      
                        def application_created
                          event = Applications::ApplicationCreatedEvent.create(Cinstance.last, User.last)
                      Severity: Minor
                      Found in app/mailers/mail_preview.rb - About 3 hrs to fix

                        Method headers_formats has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def headers_formats
                            headers.to_hash.dup.each do |name, value|
                        
                              field = "headers.#{name}"
                              next if value.blank?
                        Severity: Minor
                        Found in app/models/cms/email_template.rb - About 3 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 search has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def search
                            puts 'Searching for invalid data'
                        
                        
                            Account.providers.find_each do |p|
                        Severity: Minor
                        Found in script/detect-invalid-data.rb - About 3 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 to_xml has a Cognitive Complexity of 22 (exceeds 5 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 3 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 selector_for has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def selector_for(scope) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
                            case scope
                        
                            #
                            # Page sections
                        Severity: Major
                        Found in features/support/selectors.rb - About 3 hrs to fix

                          Method provider_request has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def provider_request
                              return unless provider?
                          
                              hourly(&:group)
                          
                          
                          Severity: Major
                          Found in lib/tracking_notifications.rb - About 3 hrs to fix

                            Method assign_drops has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def assign_drops drops
                                  assigns = (@_assigned_drops ||= {})
                            
                                  drops.stringify_keys.each do |name, drop|
                                    next if drop.nil?
                            Severity: Minor
                            Found in lib/developer_portal/lib/liquid/assigns.rb - About 2 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 up has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def self.up 
                               create_table "forums", :force => true do |t|
                                t.integer "site_id"
                                t.string  "name"
                                t.string  "description"
                            Severity: Major
                            Found in db/migrate/20081112151449_tables_for_beast.rb - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language