3scale/porta

View on GitHub

Showing 5,267 of 5,597 total issues

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

  def deliver_approved_notification
    if buyer? && approval_required?
      unless admins.empty? || admins.first.created_by_provider_signup?
        run_after_commit do
          AccountMailer.approved(self).deliver_later
Severity: Minor
Found in app/models/account/states.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 up has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.up
    model = ApiDocs::Service

    add_column :api_docs_services, :base_path, :string
    docs = model.connection.select_all "SELECT id, body FROM api_docs_services"
Severity: Minor
Found in db/migrate/20120511140727_add_base_path_to_api_docs_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 determine_template has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def determine_template(options)
        super.tap do |template|
          unless template.respond_to?(:layout)
            Rails.logger.info "#{template.inspect} is not Liquid template and can't override layout"
            next
Severity: Minor
Found in app/lib/liquid/template_support.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_and_parse_body has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def find_and_parse_body(*args)
      registers = args.extract_options!
      body = args.first

      template = find_liquid_template(full_template_name)
Severity: Minor
Found in app/lib/messenger/message_liquidizer.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 wait_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def wait_for(condition_name, max_wait_time: Capybara.default_max_wait_time, polling_interval: 0.01)
    wait_until = Time.now + max_wait_time.seconds
    loop do
      break if yield

Severity: Minor
Found in features/support/helpers/requests_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 define_route_alias has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def define_route_alias(type, new_name, old_name, &block)
        name = "#{new_name}_#{type}"

        define_method(name) do |*args|
          dynamic_args = block ? block.bind(self).call : []
Severity: Minor
Found in app/lib/forum_support/admin.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 fields_to_xml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def fields_to_xml(xml)
    defined_builtin_fields.each do |field|
      next if field_value(field.name).blank?
      value = field_value(field.name)

Severity: Minor
Found in app/lib/fields/fields.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 join_scopes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def join_scopes(selected_scopes)
        # process default scopes - reduce all default scopes to one
        scope = default_search_scopes.inject(default_search_scope) do |scope, (method, args)|
          # skip default scope if it is used explicitly in params
          next scope if selected_scopes.include?(method.to_s)
Severity: Minor
Found in app/lib/three_scale/search.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 field_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def field_value(name)
    if extra_field?(name)
      extra_fields && extra_fields[name]
    elsif respond_to?(name)
      value = public_send(name)
Severity: Minor
Found in app/lib/fields/fields.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 select has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def select(value = nil, from: nil, **options)
    if has_css?('.pf-c-form__group', text: from, wait: 0)
      within('.pf-c-form__group', text: from) do
        if has_css?('select.pf-c-form-control', wait: 0)
          super
Severity: Minor
Found in features/support/capybara_extensions.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 api_behavior has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def api_behavior
    resource = serializable
    resource = representer.prepare(resource) unless resource.frozen?

    case
Severity: Minor
Found in app/lib/three_scale/api/responder.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 parse_month has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.parse_month(month)
    return month if month.is_a?(Month)

    match = /^(\d{4})-(\d{2})$/.match(month)

Severity: Minor
Found in app/lib/month.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 fix! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.fix!(spec)
        return spec unless spec.respond_to?(:deep_dup)

        dup = spec.deep_dup.extend(Hashie::Extensions::DeepFind)
        (dup.deep_find_all('parameters') || []).flatten.each do |parameters|
Severity: Minor
Found in app/lib/three_scale/swagger/autocomplete.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 signup_notification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def signup_notification(user)
    provider = self.provider_account = user.account.provider_account

    subject = user.account.provider? ? "3scale account confirmation" : "#{account_name(user)} API account confirmation"

Severity: Minor
Found in lib/developer_portal/app/mailers/user_mailer.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 top_users has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def top_users
      return unless @hit_metric

      options = {:metric => @hit_metric, :period => @period, :timezone => @account.timezone,
                 :since => 1.send(@period).ago, :limit => 5}
Severity: Minor
Found in app/lib/pdf/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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create
      find_user_by_activation_code or return

      if @user.activate
        flash_key = @user.account.approval_required? ? 'approval_required' : 'complete'

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 ready? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def ready?
      require_relative 'connection_probe'
      config = ConnectionProbe.connection_config
      connection_string = "#{config.fetch(:adapter)}://#{config.fetch(:username)}@#{config.fetch(:host) { 'localhost' }}/#{config.fetch(:database)}"
      if ConnectionProbe.ready?
Severity: Minor
Found in lib/system/database.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 extract_table has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def extract_table(table, rows, cells = nil)
    table = find(*table)
    ActiveSupport::Deprecation.warn '[Cucumber] Table not implemented with Patternfly' unless table[:class].include?('pf-c-table')
    table.all(*rows).map do |row|
      if cells.respond_to?(:call)
Severity: Minor
Found in features/support/helpers/table_helpers.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 assign_to_message has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def assign_to_message(message)
      message.subject = @subject if @subject

      message.headers['bcc'] = @bcc if @bcc
      message.headers['cc'] = @cc if @cc
Severity: Minor
Found in lib/developer_portal/lib/liquid/tags/email.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 assign_to_mail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def assign_to_mail(mail)
      mail[:subject] = @subject if @subject
      mail[:bcc] = @bcc if @bcc
      mail[:cc] = @cc if @cc
      mail[:from] = @from if @from
Severity: Minor
Found in lib/developer_portal/lib/liquid/tags/email.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

Severity
Category
Status
Source
Language