concord-consortium/rigse

View on GitHub

Showing 1,200 of 2,135 total issues

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

  def update
    @offering = Portal::Offering.find(params[:id])
    authorize @offering
    update_successful = @offering.update(portal_offering_strong_params(params[:offering]))
    if request.xhr?
Severity: Minor
Found in rails/app/controllers/portal/offerings_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_school_district_status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def import_school_district_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 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 render_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def render_info(clazz, anonymize)
    state = nil
    if school = clazz.school
      state = school.state
    end
Severity: Minor
Found in rails/app/controllers/api/v1/classes_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

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

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

  def setup_object
    if params[:id]
      if valid_uuid(params[:id])
        @external_activity = ExternalActivity.where('uuid=?',params[:id]).first
      else
Severity: Minor
Found in rails/app/controllers/external_activities_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

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

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 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

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

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

export async function updateEntity<T extends PortalEntity>(
  clazz: OrmCLass<T>,
  params: Partial<T>,
  associationsCallback?: (entity: T) => Promise<T>
  ) {
Severity: Minor
Found in admin-panel/graphql-backend/src/helpers/entityResolverHelpers.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