concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

Function formatter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    formatter: function (v, axis) {
        var d = new Date(v);

        // first check global format
        if (axis.options.timeformat != null)
Severity: Minor
Found in rails/app/assets/javascripts/flotr/flotr.js - About 55 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 parseColor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    parseColor: function(str){
        if (str instanceof Flotr.Color) return str;
        
        var result, Color = Flotr.Color;

Severity: Minor
Found in rails/app/assets/javascripts/flotr/flotr.js - About 55 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 validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def validate
    @needs   = nil
    @choices = {}
    previous_change = false
    attr_order.each do |attr|
Severity: Minor
Found in rails/app/models/portal/school_selector.rb - About 55 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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  initialize: function(element) {
    var defaults = {
      handle: false,
      reverteffect: function(element, top_offset, left_offset) {
        var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
Severity: Minor
Found in rails/app/assets/javascripts/dragdrop.js - About 55 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 setAltitude has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  setAltitude: function(win, altitude) {
    var stack = this.stack;

    if (altitude === "front") {
      if (stack.getFrontWindow() === win) return;
Severity: Minor
Found in rails/app/assets/javascripts/livepipe/window.js - About 55 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 persist! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def persist!
    # Due to the race condition it may happen that login isn't unique.
    # See: https://www.pivotaltracker.com/story/show/79274428
    # There are two moments when it can be detected:
    # - ActiveRecord validation
Severity: Minor
Found in rails/app/models/api/v1/student_registration.rb - About 55 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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def update

    @action_type = 'Edit Notice'
    @notice = Admin::SiteNotice.find(params[:id])
    #authorize @notice
Severity: Minor
Found in rails/app/controllers/admin/site_notices_controller.rb - About 55 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 navigation_service has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def navigation_service(params={})
    _params = {
      name: current_visitor.name,
      request_path: request.path,
    }
Severity: Minor
Found in rails/app/helpers/navigation_helper.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(_learner)
    self.learner         = _learner
    self.student_name    = lookup "student.user.name"
    self.student_login   = lookup "student.user.login"
    self.teacher_name    = lookup "offering.clazz.teacher.name"
Severity: Minor
Found in rails/app/models/learner_detail.rb - About 55 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 x_link_for has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def x_link_for(component, verb, as_name = nil, params = {})
    link_text = params.delete(:link_text) || "#{verb} "
    url = run_url_for(component, params, params.delete(:format))

    run_type = case component
Severity: Minor
Found in rails/app/helpers/runnables_helper.rb - About 55 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_standard_statements has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def get_standard_statements

    key                     = ENV['ASN_API_KEY']
    document_id             = params[:asn_document_id]
    statement_notation_q    = params[:asn_statement_notation_query]
Severity: Minor
Found in rails/app/controllers/api/v1/materials_controller.rb - About 55 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_options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def select_options
      options = []
      if self.question && !self.question.empty?
        options << "<option value=\"current\" selected>#{self.question}</option>".html_safe unless self.id.nil?
      else
Severity: Minor
Found in rails/app/models/security_question.rb - About 55 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 update_image_attributes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def update_image_attributes
    my_params  = params[:image]
    return unless my_params
    image      = my_params.delete(:image)
    img_params = {:image => image}
Severity: Minor
Found in rails/app/controllers/images_controller.rb - About 55 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 pundit_user_not_authorized has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def pundit_user_not_authorized(exception)
    # without the no-store Chrome will cache this redirect in some cases
    # for example if a student tries to access a collection page, and then they
    # log out and try to access it again. In this case Chrome sends them to the
    # cached location of "/my-classes". By default rails adds 'no-cache' but that isn't
Severity: Minor
Found in rails/app/controllers/application_controller.rb - About 55 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_study_materials has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def self.create_default_study_materials
    default_external_activities = []
    @default_external_activities = default_external_activities

    # External Activity
Severity: Minor
Found in rails/lib/mock_data/create_default_data.rb - About 55 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 renderAuthorInfo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  renderAuthorInfo () {
    const credits = (this.props.material.credits != null ? this.props.material.credits.length : undefined) > 0
      ? this.props.material.credits
      : (this.props.material.user != null ? this.props.material.user.name.length : undefined) > 0
        ? this.props.material.user.name
Severity: Minor
Found in rails/react-components/src/library/components/search/material-info.tsx - About 55 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 apiCall has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  apiCall (action: any, options: any) {
    const teacherClassesBasePath = "/api/v1/teacher_classes";
    const classesBasePath = "/api/v1/classes";
    let { clazz, data, onSuccess } = options;

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

  render () {
    const anonymous = this.props.anonymous;

    const providerComponents = [];
    if (enableAuthProviders && this.props.oauthProviders) {
Severity: Minor
Found in rails/react-components/src/library/components/signup/basic_data_form.tsx - About 55 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 EditStudentPermissionsForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const EditStudentPermissionsForm = ({ student, permissionForms, onFormCancel, onFormSave }: CreateEditPermissionFormProps) => {
  const [localPermissions, setLocalPermissions] = useState(student.permission_forms || []);

  useEffect(() => {
    setLocalPermissions(student.permission_forms);

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if (this.between((offsets[0] + this.element.offsetWidth) - pointer[0], 0, this.options.right)) cursor += 'e';
Severity: Minor
Found in rails/app/assets/javascripts/misc/resizable.js and 1 other location - About 55 mins to fix
rails/app/assets/javascripts/misc/resizable.js on lines 179..179

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language