3scale/porta

View on GitHub

Showing 5,205 of 5,561 total issues

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

File provider_steps.rb has 281 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_test?
end
Severity: Minor
Found in features/step_definitions/provider_steps.rb - About 2 hrs to fix

    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

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

      box.find(".select-plan-button").click(function(){
      var planID = $(this).attr('data-plan-id');
      var planName = $(this).attr('data-plan-name');
      box.fadeOut();
      PlanWidget.callback(planName, planID);
      Severity: Major
      Found in lib/developer_portal/app/assets/javascripts/plans_widget.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/provider/plans_widget.js on lines 76..81

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

      box.find(".select-plan-button").click(function(){
      var planID = $(this).attr('data-plan-id');
      var planName = $(this).attr('data-plan-name');
      box.fadeOut();
      PlanWidget.callback(planName, planID);
      Severity: Major
      Found in app/assets/javascripts/provider/plans_widget.js and 1 other location - About 2 hrs to fix
      lib/developer_portal/app/assets/javascripts/plans_widget.js on lines 69..74

      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

        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

        File application_helper.rb has 267 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

          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 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 Settings has 22 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Settings < ApplicationRecord
                    include Symbolize
                    belongs_to :account, inverse_of: :settings
                     
                    audited allow_mass_assignment: true
                    Severity: Minor
                    Found in app/models/settings.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

                          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
                                Severity
                                Category
                                Status
                                Source
                                Language