concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

Method featured has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def featured
    materials = ExternalActivity.published.where(:is_featured => true).includes([:user]).to_a

    if params[:prioritize].present?
      prioritize = params[:prioritize].split(',').map { |p| p.to_i rescue 0 }
Severity: Minor
Found in rails/app/controllers/api/v1/materials_controller.rb - About 35 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 run_url_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def run_url_for(component, params = {}, format = nil)
    if component.instance_of? Interactive
      return component.url
    end

Severity: Minor
Found in rails/app/helpers/runnables_helper.rb - About 35 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_asn_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def process_asn_response(hits, applied_map = {})

    #
    # Find our local peristed copy of the document these statements belong to.
    #
Severity: Minor
Found in rails/app/controllers/api/v1/materials_controller.rb - About 35 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 import_user_status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def import_user_status
    # PUNDIT_REVIEW_AUTHORIZE
    # PUNDIT_CHOOSE_AUTHORIZE
    # no authorization needed ...
    # authorize Import::Import
Severity: Minor
Found in rails/app/controllers/import/imports_controller.rb - About 35 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 resolve has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def resolve
      return none unless user

      if user.has_role?('admin')
        all
Severity: Minor
Found in rails/app/policies/portal/offering_policy.rb - About 35 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 respond has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def respond
    if params[:user]
      unless User.verified_imported_user?(params[:user][:login])
        session[:login] = params[:user][:login]
        redirect_to import_confirm_user_imported_login_path and return
Severity: Minor
Found in rails/lib/custom_failure.rb - About 35 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 external_copyable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def external_copyable(material)
      if !(material.is_a? ExternalActivity) || material.author_url.blank?
        return false
      end

Severity: Minor
Found in rails/lib/materials/data_helpers.rb - About 35 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_default_runnable_for_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def create_default_runnable_for_user(user, name="simple default #{TOP_LEVEL_CONTAINER_NAME}", logging=false)
      unless runnable = user.send(TOP_LEVEL_CONTAINER_NAME_PLURAL).find_by_name(name)
        runnable = TOP_LEVEL_CONTAINER_NAME.camelize.constantize.create do |i|
          i.name = name
          i.user = user
Severity: Minor
Found in rails/lib/default_runnable.rb - About 35 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 arg_block has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def arg_block(learners)
    authoring_sites = learners.select { |l| l.runnable_type == "ExternalActivity" }.map do |learner|
      uri = URI(learner.runnable.url)
      "#{uri.scheme}://#{uri.host}:#{uri.port}"
    end
Severity: Minor
Found in rails/app/controllers/report/learner_controller.rb - About 35 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 clipboard_object_name has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def clipboard_object_name(options={})
    obj = clipboard_object(options)
    name = "(unknown object)"
    if obj
      if (obj.class.respond_to? :display_name) && obj.class.display_name
Severity: Minor
Found in rails/lib/clipboard.rb - About 35 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 get_clipboard_object has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def get_clipboard_object(clipboard_data_type, clipboard_data_id)
    results = nil
    if clipboard_data_type && clipboard_data_type != 'null' && clipboard_data_id
      begin
        clazz = clipboard_data_type.de_clipboardify.classify.constantize
Severity: Minor
Found in rails/lib/clipboard.rb - About 35 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 filtered_by_cohorts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def self.filtered_by_cohorts(allowed_cohorts = [])
        params = {}
        cohorts_where = allowed_cohorts.map.with_index do |cohort, i|
          params["name#{i}".intern] = cohort.name
          if cohort.project_id
Severity: Minor
Found in rails/lib/search_model_interface.rb - About 35 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 resolve has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def resolve
      return none unless user

      if user.has_role?('admin')
        all
Severity: Minor
Found in rails/app/policies/portal/clazz_policy.rb - About 35 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_section has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def add_section(item)
    if section = @sections[item.id]
      section.merge(item)
    else
      section = item
Severity: Minor
Found in rails/app/services/navigation_service.rb - About 35 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 setup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def setup
    @button_texts = {
      :apply => 'Apply Filters',
      :usage => 'Usage Report',
      :details => 'Details Report',
Severity: Minor
Found in rails/app/controllers/report/learner_controller.rb - About 35 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 valid? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.valid?(url, opts={})
    options = {
      :max_size => 0,
      :do_head => true
    }  
Severity: Minor
Found in rails/lib/url_checker.rb - About 35 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 token_valid? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def token_valid?
      token = token_value
      return false unless token
      grant = AccessGrant.find_by_access_token(token)
      return false unless grant && grant.client
Severity: Minor
Found in rails/lib/bearer_token/bearer_token_authenticatable.rb - About 35 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 sortByName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const sortByName = function (a: any, b: any) {
  const aName = a.name;
  const bName = b.name;

  if (aName === null || aName === "") {
Severity: Minor
Found in rails/react-components/src/library/helpers/sort-resources.ts - About 35 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 apiPost has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const apiPost = (url: any, options: any) => {
  const { onSuccess, errorMessage } = options;
  let { type, data, onError } = options;

  type = type || "POST";
Severity: Minor
Found in rails/react-components/src/library/helpers/api/post.ts - About 35 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 request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const request = async ({ url, method, body, onError }: IOptions) => {
  try {
    const response = await fetch(url, {
      method,
      headers: {
Severity: Minor
Found in rails/react-components/src/library/helpers/api/request.ts - About 35 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