3scale/porta

View on GitHub

Showing 5,267 of 5,597 total issues

Method human_filesize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def human_filesize(bytes)
    amount, units = bytes, 'bytes'
    kilos = bytes / 1024
    if kilos > 1
      amount, units = kilos, 'KB'
Severity: Minor
Found in app/helpers/file_size_helper.rb - About 25 mins 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 attach_section has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def attach_section(template)
      return unless type == :page

      section = find_section
      if section.present?
Severity: Minor
Found in app/services/admin/api/cms/template_service.rb - About 25 mins 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

Function dateFormat has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    dateFormat: function(format, timestamp, capitalize) {
        function pad (number) {
            return number.toString().replace(/^([0-9])$/, '0$1');
        }

Severity: Minor
Found in app/assets/javascripts/threescale.js - About 25 mins 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 process! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def process!(credit_card_auth_code, gateway, options)
    unless System::Application.config.three_scale.payments.enabled
      logger.info "Skipping payment transaction #process! - not in production"
      return
    end
Severity: Minor
Found in app/models/payment_transaction.rb - About 25 mins 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 find_cinstance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def find_cinstance
    begin
      @cinstance = if current_account.buyer?
        #TODO: this allows a buyer to pass any app_id, and it will show no matter the app not being 'live'
        if params[:application_id]
Severity: Minor
Found in app/controllers/stats/data/applications_controller.rb - About 25 mins 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    session_return_to
    logout_keeping_session!

    @user, strategy = authenticate_user if bot_check
Severity: Minor
Found in app/controllers/provider/sessions_controller.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(user:, params:, provider:) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
    @user = user
    @params = params
    @provider = provider

Severity: Minor
Found in app/presenters/buyers/service_contracts_index_presenter.rb - About 25 mins 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 notify_entitlements has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def notify_entitlements
    return unless entitlements_notification_enabled?

    if plan_downgrade? || recently_suspended?
      notify_entitlements_revoked
Severity: Minor
Found in app/services/support_entitlements_service.rb - About 25 mins 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 attach_layout has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def attach_layout
      return unless resource_class == CMS::Page

      layout = find_layout
      if layout.present?
Severity: Minor
Found in app/services/admin/api/cms/template_service.rb - About 25 mins 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 push_user? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def push_user?
      return true unless user

      # return if providers accounts do not match
      return unless resource.provider_account == self.provider
Severity: Minor
Found in app/models/web_hook/event.rb - About 25 mins 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 find_or_default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def find_or_default(id = nil)
        owner = proxy_association.owner
        raise ProviderOnlyMethodCalledError if owner.buyer?

        # TODO
Severity: Minor
Found in app/models/account/provider_methods.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(provider_account, cinstance, service)

      # If we got object which responds to id - it is AR object
      # we wan't to cache it and do not query DB again
      # but in case it is id, we will load it - check #provider_account and others
Severity: Minor
Found in app/models/backend/cinstance_data.rb - About 25 mins 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 default_service_plan_state has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def default_service_plan_state
    return unless account && account.provider_can_use?(:published_service_plan_signup)
    return if account.should_be_deleted?
    account.settings.service_plans_ui_visible? ? 'hidden' : 'published'
  end
Severity: Minor
Found in app/models/service.rb - About 25 mins 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    user = domain_account.users.find_by_activation_code(activation_code)

    return redirect_to provider_login_path unless user

Severity: Minor
Found in app/controllers/provider/activations_controller.rb - About 25 mins 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 charge! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def charge!(amount, options = {})
    unless credit_card_stored?
      logger.info("Buyer #{self.id} was not charged: credit card missing")
      raise Finance::Payment::CreditCardMissing
    end
Severity: Minor
Found in app/models/account/billing.rb - About 25 mins 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 add_remove_by_ids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_remove_by_ids( model_type, inside_ids)
    all = provider.send(model_type.to_s.pluralize)
    inside = self.send(model_type.to_s.pluralize)

    inside_ids = (inside_ids || []).uniq
Severity: Minor
Found in app/models/cms/section.rb - About 25 mins 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 cost_for_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def cost_for_value(value)
    if value < min
      0
    elsif value == max && value == min
      cost_per_unit
Severity: Minor
Found in app/models/pricing_rule.rb - About 25 mins 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 find_cinstance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def find_cinstance
    begin
      @cinstance = if current_account.buyer?
                     #TODO: this allows a buyer to pass any app_id, and it will show no matter the app not being 'live'
                     if params[:application_id]
Severity: Minor
Found in app/controllers/stats/api/applications_controller.rb - About 25 mins 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 current_password_verification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def current_password_verification
    return true unless current_user.using_password?

    unless current_user.authenticated?(user_params[:current_password])
      flash.now[:error] = 'Current password is incorrect.'
Severity: Minor
Found in app/controllers/provider/admin/user/personal_details_controller.rb - About 25 mins 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

Function numberPadding has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  numberPadding: function(number, decimals){
    var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals,
        d = ".",
        t = ",",
        i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
Severity: Minor
Found in app/assets/javascripts/threescale.js - About 25 mins 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

Severity
Category
Status
Source
Language