concord-consortium/rigse

View on GitHub

Showing 1,191 of 2,112 total issues

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

  def students_in_class(all_students)
    all_students.to_a.compact.uniq.sort{|a,b| (a.user ? [a.first_name, a.last_name] : ["",""]) <=> (b.user ? [b.first_name, b.last_name] : ["",""])}
  end
Severity: Minor
Found in rails/app/helpers/application_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 check_auth has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def check_auth(params)
    begin
      user, role = check_for_auth_token(params)
    rescue StandardError => e
      return {error: e.message}
Severity: Minor
Found in rails/app/controllers/api/v1/bookmarks_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 add_item has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_item(item_spec)
    item = NavItem.new(item_spec)
    unless(item.type)
      item.type = item.url ? LINK_TYPE : SECTION_TYPE
    end
Severity: Minor
Found in rails/app/services/navigation_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 add_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_link(item)
    if link = @links.find {|l| l.id == item.id}
      link.merge(item)
    else
      link = item
Severity: Minor
Found in rails/app/services/navigation_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 up has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def up
    Portal::Student.reset_column_information
    Portal::Learner.reset_column_information
    Dataservice::BundleLogger.reset_column_information
    Dataservice::BundleContent.reset_column_information

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
    # remove them first, just in case they exist.
    # rescue errors, in case they don't.
    remove_index :report_learners, :school_id rescue nil
    remove_index :report_learners, :learner_id rescue nil
Severity: Minor
Found in rails/db/migrate/20120320150044_ensure_report_learners_has_indexes.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 up
    add_column :portal_collaborations, :offering_id, :integer

    # Add this index temporarily, so the processing below can work reasonably fast.
    # This index will be added permanently in the next migration.
Severity: Minor
Found in rails/db/migrate/20141001164955_add_offering_to_portal_collaborations.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 school_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def school_for(row)
    school_name = row[:school_name].titlecase.strip
    cached_school = self.schools[school_name]
    if cached_school
      log("School Cache hit for #{school_name}")
Severity: Minor
Found in rails/lib/school_importer.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 index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    if ENV['DYNAMIC_ROBOTS_TXT'] == 'true'

        lines = []

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

    def resolve
      if user && user.has_role?('manager','admin','researcher')
        all
      elsif user && (user.is_project_admin? || user.is_project_researcher?)
        # prevents a bunch of unnecessary model loads by not using the model scopes
Severity: Minor
Found in rails/app/policies/portal/teacher_policy.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 dup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def dup(options = {})
    if self.class.respond_to?("cloneable_associations")
      new_assocs = self.class.cloneable_associations
    else
      new_assocs = []
Severity: Minor
Found in rails/lib/cloneable.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 district_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def district_for(row)
    district_name = row[:district_name].titlecase.strip
    cached_district = self.districts[:district_name]
    if cached_district
      log("District cache hit")
Severity: Minor
Found in rails/lib/school_importer.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 parseQueryString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const parseQueryString = function (queryString?: any) {
  if (queryString == null) {
    queryString = window.location.search.replace(/^\?/, "");
  }
  const vars = queryString.split("&");
Severity: Minor
Found in rails/react-components/src/library/helpers/parse-query-string.ts - 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 owned? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def owned?
    if self.respond_to? :user
      if self.user.nil?
        return false
      end
Severity: Minor
Found in rails/lib/changeable.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_default_interactives has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.create_default_interactives
    puts
    puts
    count = 0
    Interactive.destroy_all
Severity: Minor
Found in rails/lib/mock_data/create_default_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 remove_teachers_test_students has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.remove_teachers_test_students
    teachers = Portal::Teacher.all
    teachers.each do |teacher|
      user = teacher.user
      if user
Severity: Minor
Found in rails/lib/fixups.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 load_db has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def load_db(district_data_files, school_data_files)
    ## Delete all the entries first
    ## Use the TRUNCATE cammand -- works in mysql to effectively empty the database and reset
    ## the autogenerating primary key index ... not certain about other databases
    if @states_and_provinces && @states_and_provinces.empty?
Severity: Minor
Found in rails/lib/nces_parser.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 rename has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def rename(old_name,new_name)
  #rename files:
  types = "{rb,haml,erb,html,rjs,js}"

  # specify the replacesments list, to ensure 
Severity: Minor
Found in rails/lib/rename_model.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 teacherProjectViewsList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  teacherProjectViewsList () {
    const { showLoadingMessage, teacherProjectViews, loaded } = this.state;
    if (!loaded) {
      if (showLoadingMessage === false) {
        return null;

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

  onChange (event: any) {
    const cursor = event.target.selectionStart;
    let newVal = event.currentTarget.value;
    const delay = this.props.isValidValue(newVal) ? 0 : TIMEOUT;

Severity: Minor
Found in rails/react-components/src/library/components/signup/text_input.tsx - 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