3scale/porta

View on GitHub

Showing 307 of 5,713 total issues

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

                Class Configuration has 25 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Configuration
                
                  include Enumerable
                
                  HARDWIRED_DEFAULTS = {
                Severity: Minor
                Found in app/models/configuration.rb - About 2 hrs to fix

                  Class UserTracking has 25 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      class UserTracking
                  
                        error_handler = ->(status, error) do
                          System::ErrorReporting.report_error(error_message: error, parameters: { status: status })
                        end
                  Severity: Minor
                  Found in app/lib/three_scale/analytics/user_tracking.rb - About 2 hrs to fix

                    Class Invoice has 25 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        class Invoice < Drops::Model
                    
                          allowed_name :invoice, :invoices
                    
                          example %{
                    Severity: Minor
                    Found in lib/developer_portal/lib/liquid/drops/invoice.rb - About 2 hrs to fix

                      Class User has 25 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          class User < Drops::Model
                            allowed_name :user, :users
                      
                            drop_example %{
                              <h1>User {{ user.display_name }}</h1>
                      Severity: Minor
                      Found in lib/developer_portal/lib/liquid/drops/user.rb - About 2 hrs to fix

                        Function disableInterface has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                             function disableInterface(){
                               function enable_checkboxes(){
                                 checkboxes_disabled(false);
                               }
                        
                        
                        Severity: Major
                        Found in app/assets/javascripts/application.js - About 2 hrs to fix

                          Method extract_range_and_granularity has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def extract_range_and_granularity(options)
                                  if options[:period]
                                    period = sanitize_period(options[:period])
                                    granularity = options[:granularity] || GRANULARITIES[period]
                                    length = 1.send(period)
                          Severity: Minor
                          Found in app/lib/stats/views/usage.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

                          Class Provider has 24 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                              class Provider < Drops::Base
                          
                                example %(
                                  <div>Domain {{ provider.domain }}</div>
                          
                          
                          Severity: Minor
                          Found in lib/developer_portal/lib/liquid/drops/provider.rb - About 2 hrs to fix

                            File provider_steps.rb has 276 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            def import_simple_layout(provider)
                              simple_layout = SimpleLayout.new(provider)
                              simple_layout.import_pages!
                              simple_layout.import_js_and_css! if @javascript
                            end
                            Severity: Minor
                            Found in features/step_definitions/provider_steps.rb - About 2 hrs to fix

                              Class InvoiceReportData has 23 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              class Pdf::Finance::InvoiceReportData
                              
                                LINE_ITEMS_HEADING = %w[Name Quantity Cost Charged].freeze
                                DATE_FORMAT = "%e %B, %Y"
                                LOGO_ATTACHMENT_STYLE = :invoice
                              Severity: Minor
                              Found in app/lib/pdf/finance/invoice_report_data.rb - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language