killbill/killbill-admin-ui

View on GitHub

Showing 72 of 101 total issues

Method _check_object_exist has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def _check_object_exist(uuid, object_type)
      param_uuid = uuid
      param_object_type = object_type

      test_uuid = nil
Severity: Minor
Found in app/controllers/kaui/custom_fields_controller.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 pagination has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def pagination
      searcher = lambda do |search_key, offset, limit|
        if Kaui::Payment::TRANSACTION_STATUSES.include?(search_key)
          # Search is done by payment state on the server side, see http://docs.killbill.io/latest/userguide_payment.html#_payment_states
          payment_state = if %w[PLUGIN_FAILURE UNKNOWN].include?(search_key)
Severity: Minor
Found in app/controllers/kaui/payments_controller.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

File kaui_override.js has 313 lines of code (exceeds 250 allowed). Consider refactoring.
Open

jQuery(document).ready(function ($) {

    /*
     * Mobile Data Adjustment
     */
Severity: Minor
Found in app/assets/javascripts/kaui/kaui_override.js - About 3 hrs to fix

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

        def create
          plan_name = params.require(:plan_name)
          @base_product_name = params[:base_product_name]
          @subscription = Kaui::Subscription.new(params.require(:subscription).delete_if { |_key, value| value.blank? })
    
    
    Severity: Minor
    Found in app/controllers/kaui/subscriptions_controller.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 index has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def index
          @account_id = params[:account_id]
    
          unless params[:max_date].blank?
            begin
    Severity: Minor
    Found in app/controllers/kaui/queues_controller.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 initialize has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(user)
          if Kaui.demo_mode
            # Show the links, the server will enforce permissions
            can :manage, :all
            return
    Severity: Minor
    Found in app/models/kaui/ability.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 create has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def create
          @custom_field = Kaui::CustomField.new(params.require(:custom_field))
    
          param_uuid = @custom_field.object_id
    
    
    Severity: Major
    Found in app/controllers/kaui/custom_fields_controller.rb - About 2 hrs to fix

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

          def create
            @custom_field = Kaui::CustomField.new(params.require(:custom_field))
      
            param_uuid = @custom_field.object_id
      
      
      Severity: Minor
      Found in app/controllers/kaui/custom_fields_controller.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 _check_object_exist has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def _check_object_exist(uuid, object_type)
            param_uuid = uuid
            param_object_type = object_type
      
            test_uuid = nil
      Severity: Major
      Found in app/controllers/kaui/custom_fields_controller.rb - About 2 hrs to fix

        Method pagination has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def pagination
              searcher = lambda do |search_key, offset, limit|
                if Kaui::Payment::TRANSACTION_STATUSES.include?(search_key)
                  # Search is done by payment state on the server side, see http://docs.killbill.io/latest/userguide_payment.html#_payment_states
                  payment_state = if %w[PLUGIN_FAILURE UNKNOWN].include?(search_key)
        Severity: Major
        Found in app/controllers/kaui/payments_controller.rb - About 2 hrs to fix

          Method show has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def show
                # Go to the database once
                cached_options_for_klient = options_for_klient
          
                @invoice = Kaui::Invoice.find_by_id(params.require(:id), false, 'FULL', cached_options_for_klient)
          Severity: Major
          Found in app/controllers/kaui/invoices_controller.rb - About 2 hrs to fix

            Method create has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def create
                  @payment_method             = Kaui::PaymentMethod.new(params[:payment_method].delete_if { |_key, value| value.blank? })
                  # Transform "1" into boolean
                  @payment_method.is_default  = @payment_method.is_default == '1'
                  # Sensible default
            Severity: Major
            Found in app/controllers/kaui/payment_methods_controller.rb - About 2 hrs to fix

              Method included has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def self.included(base_class)
                    base_class.class_eval do
                      # Required to build urls in views
                      extend  ActiveModel::Naming
                      include ActiveModel::Validations
              Severity: Minor
              Found in app/models/kaui/rails_methods.rb - About 1 hr to fix

                Function setObjectIdPopover has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function setObjectIdPopover(){
                    $(".object-id-popover").each(function(idx, e){
                        $(this).popover('destroy');
                        $(this).off("shown.bs.popover");
                        $(this).data("index", idx);
                Severity: Minor
                Found in app/assets/javascripts/kaui/kaui_override.js - About 1 hr to fix

                  Method from_overdue_form_model has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def from_overdue_form_model(view_form_model)
                          result = KillBillClient::Model::Overdue.new
                          result.initial_reevaluation_interval = nil # TODO
                          result.overdue_states = []
                          view_form_model['states'].each do |state_model|
                  Severity: Minor
                  Found in app/models/kaui/overdue.rb - About 1 hr 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 index has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def index
                        cached_options_for_klient = options_for_klient
                  
                        fetch_bundles = promise { @account.bundles(cached_options_for_klient) }
                        fetch_bundle_tags = promise do
                  Severity: Minor
                  Found in app/controllers/kaui/bundles_controller.rb - About 1 hr to fix

                    Method get_tenant_catalog_json has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def get_tenant_catalog_json(requested_date = nil, account_id = nil, options = {})
                            super
                          rescue ::KillBillClient::API::InternalServerError => e
                            if !e.response.nil? && !e.response.body.nil?
                              error_message = begin
                    Severity: Minor
                    Found in app/models/kaui/catalog.rb - About 1 hr 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 get_active_bundle_or_latest_created has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def self.get_active_bundle_or_latest_created(bundles, time_zone = nil)
                          return nil if bundles.empty?
                    
                          latest_start_date = nil
                          latest_bundle     = nil
                    Severity: Minor
                    Found in app/models/kaui/bundle.rb - About 1 hr 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 pagination has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def pagination
                          cached_options_for_klient = options_for_klient
                    
                          searcher = lambda do |search_key, offset, limit|
                            account = begin
                    Severity: Minor
                    Found in app/controllers/kaui/invoices_controller.rb - About 1 hr to fix

                      Method build_existing_simple_plans has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def build_existing_simple_plans(catalog)
                              tmp = catalog.products.map do |p|
                                p.plans.each do |plan|
                                  class << plan
                                    attr_accessor :product_name, :product_category
                      Severity: Minor
                      Found in app/models/kaui/catalog.rb - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language