3scale/porta

View on GitHub

Showing 309 of 5,637 total issues

File application_helper.rb has 270 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module ApplicationHelper # rubocop:disable Metrics/ModuleLength

  # this is used just to not load font awesome in tests
  def capybara_webkit?
    Rails.env.test? && defined?(Capybara.current_driver) && Capybara.current_driver == :webkit
Severity: Minor
Found in app/helpers/application_helper.rb - About 2 hrs to fix

    Method friendly_service_setting has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      def friendly_service_setting service, setting
        value = service.send setting
        message, value = case setting
                         when :custom_keys_enabled
          ['Custom application keys are VALUE', value ? 'enabled' : 'disabled']
    Severity: Minor
    Found in app/helpers/api/services_helper.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

    File rolling_updates.rb has 266 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Logic
      module RollingUpdates
        class UnknownFeatureError < StandardError; end
        class UnknownFeatureConfigError < StandardError
          include Bugsnag::MetaData
    Severity: Minor
    Found in app/lib/logic/rolling_updates.rb - About 2 hrs to fix

      File simple_layout.rb has 265 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'sprockets'
      require 'compass-rails'
      require 'sass'
      
      class SimpleLayout
      Severity: Minor
      Found in app/lib/simple_layout.rb - About 2 hrs to fix

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

        module Liquid
          module Drops
            class Account < Drops::Model
        
              info %{
        Severity: Minor
        Found in lib/developer_portal/lib/liquid/drops/account.rb - About 2 hrs to fix

          Class Template has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class CMS::Template < ApplicationRecord
            include Symbolize
            include ThreeScale::Search::Scopes
            include CMS::Filtering
          
          
          Severity: Minor
          Found in app/models/cms/template.rb - About 2 hrs to fix

            Class FrontendController has 22 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class FrontendController < ApplicationController
              SecureHeaders::Configuration.override(:disable_x_frame) do |config|
                config.x_frame_options = SecureHeaders::OPT_OUT
              end
            
            
            Severity: Minor
            Found in app/controllers/frontend_controller.rb - About 2 hrs to fix

              Class ClusterClient has 22 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class ClusterClient
                  class ClusterClientError < StandardError; end
              
                  class ResourceNotFound < ClusterClientError
                    def initialize(resource_type, name, namespace, labels = {})
              Severity: Minor
              Found in app/models/service_discovery/cluster_client.rb - About 2 hrs to fix

                Class Contract has 22 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Contract < ApplicationRecord
                  # Need to define table_name before audited because of
                  # https://github.com/collectiveidea/audited/blob/f03c5b5d1717f2ebec64032d269316dc74476056/lib/audited/auditor.rb#L305-L311
                  self.table_name = 'cinstances'
                
                
                Severity: Minor
                Found in app/models/contract.rb - About 2 hrs to fix

                  Class ClientBase has 22 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      class ClientBase
                        class ClientError < StandardError
                          include Bugsnag::MetaData
                  
                          def initialize(error_message, options = {})
                  Severity: Minor
                  Found in app/lib/three_scale/oauth2/client_base.rb - About 2 hrs to fix

                    Method assert_line_items has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def assert_line_items(items)
                      items.hashes.each_with_index do |line, i|
                        name = line['name']
                        cost = line['cost']
                        cost = /#{cost}\./ unless cost.include?('.')
                    Severity: Minor
                    Found in features/step_definitions/finance/invoicing_steps.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

                    File email_template.rb has 257 lines of code (exceeds 250 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 2 hrs to fix

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

                      class CMS::Section < ApplicationRecord
                        include ThreeScale::Search::Scopes
                        include CMS::Filtering
                        extend System::Database::Scopes::IdOrSystemName
                        include NormalizePathAttribute
                      Severity: Minor
                      Found in app/models/cms/section.rb - About 2 hrs to fix

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

                        class ApplicationKey < ApplicationRecord
                          include SaveDestroyForApplicationAssociation
                        
                          KEYS_LIMIT = 5
                        
                        
                        Severity: Minor
                        Found in app/models/application_key.rb - About 2 hrs to fix

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

                            class Event
                              class Error < ::StandardError; end
                              class MissingResourceError < Error; end
                          
                              # This object represents one webhook event
                          Severity: Minor
                          Found in app/models/web_hook/event.rb - About 2 hrs to fix

                            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

                                  Method verify! has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                          def verify!(object)
                                  
                                            # this controller shouldnt be checked
                                            return true if @env["action_controller.request.path_parameters"]["controller"] == "provider/domains"
                                  
                                  
                                  Severity: Minor
                                  Found in lib/three_scale/middleware/multitenant.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 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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language