concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

Method initialize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(student, offering, protocol, host_with_port, anonymize = false)
      self.name = anonymize ? "#{student.anonymized_first_name} #{student.anonymized_last_name}" : student.user.name
      self.first_name = anonymize ? student.anonymized_first_name : student.user.first_name
      self.last_name = anonymize ? student.anonymized_last_name : student.user.last_name
      self.username = student.user.login
Severity: Minor
Found in rails/app/models/api/v1/offering.rb - About 2 hrs 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 finishDrag has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  finishDrag: function(event, success) {
    this.dragging = false;

    if(this.options.quiet){
      Position.prepare();
Severity: Minor
Found in rails/app/assets/javascripts/dragdrop.js - About 2 hrs 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 computeSize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  computeSize: function(width, height, innerSize) {
    var innerWidth, innerHeight, outerWidth, outerHeight;
      if (innerSize) {
        outerWidth  =  width  + this.borderSize.width;
        outerHeight =  height + this.borderSize.height;
Severity: Minor
Found in rails/app/assets/javascripts/livepipe/window.js - About 2 hrs 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 onEmptyHover has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  onEmptyHover: function(element, dropon, overlap) {
    var oldParentNode = element.parentNode;
    var droponOptions = Sortable.options(dropon);

    if(!Element.isParent(dropon, element)) {
Severity: Minor
Found in rails/app/assets/javascripts/dragdrop.js - About 2 hrs 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 require_role has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def require_role(roles, options = {})
      options.assert_valid_keys(:if, :unless,
        :for, :only,
        :for_all_except, :except
      )
Severity: Minor
Found in rails/lib/role_requirement_system.rb - About 2 hrs 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

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

      'bottom': function(element) {
        var offset = element.positionedOffset(),
          parent = element.getOffsetParent(),
          pHeight = parent.measure('height');

Severity: Major
Found in rails/app/assets/javascripts/prototype.js and 1 other location - About 2 hrs to fix
rails/app/assets/javascripts/prototype.js on lines 3889..3897

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

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

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

                    for(var i = 0; i < this._observers[event_name].length; ++i)
                        collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args) || null);
Severity: Major
Found in rails/app/assets/javascripts/livepipe/livepipe.js and 1 other location - About 2 hrs to fix
rails/app/assets/javascripts/livepipe/livepipe.js on lines 58..59

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

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

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

      'right': function(element) {
        var offset = element.positionedOffset(),
          parent = element.getOffsetParent(),
          pWidth = parent.measure('width');

Severity: Major
Found in rails/app/assets/javascripts/prototype.js and 1 other location - About 2 hrs to fix
rails/app/assets/javascripts/prototype.js on lines 3874..3882

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

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

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

                for(var i = 0; i < this._observers[event_name].length; ++i)
                    collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args) || null);
Severity: Major
Found in rails/app/assets/javascripts/livepipe/livepipe.js and 1 other location - About 2 hrs to fix
rails/app/assets/javascripts/livepipe/livepipe.js on lines 86..87

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

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

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

    for (const filter of ["start_date", "end_date"]) {
      if ((this.state[filter] != null ? this.state[filter].length : undefined) > 0) {
        params[filter] = formatInputDateToMMDDYYYY(this.state[filter]);
      }
    }
rails/react-components/src/library/components/user-report-form/index.tsx on lines 122..126

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

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

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

    for (const filter of ["start_date", "end_date"]) {
      if ((this.state[filter] != null ? this.state[filter].length : undefined) > 0) {
        params[filter] = formatInputDateToMMDDYYYY(this.state[filter]);
      }
    }
rails/react-components/src/library/components/learner-report-form/index.tsx on lines 177..181

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

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

Function setMatcher has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
    if ( postFilter && !postFilter[ expando ] ) {
        postFilter = setMatcher( postFilter );
    }
    if ( postFinder && !postFinder[ expando ] ) {
Severity: Major
Found in rails/app/assets/javascripts/jquery/jquery.js - About 2 hrs to fix

    Method check_for_auth_token has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def check_for_auth_token(params)
        header = request.headers["Authorization"]
        if header && header =~ /^Bearer (.*)$/i
          token = $1
          grant = AccessGrant.find_by_access_token(token)
    Severity: Major
    Found in rails/app/controllers/api/api_controller.rb - About 2 hrs to fix

      Method register has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def register
          result = get_portal_clazz_by_id(params)
          return error(result[:error]) if result[:error]
          portal_clazz = result[:portal_clazz]
      
      
      Severity: Major
      Found in rails/app/controllers/api/v1/students_controller.rb - About 2 hrs to fix

        Method up has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.up
            create_table :domains do |t|
              t.string :name
              t.string :key
              t.column :uuid, :string, :limit => 36
        Severity: Major
        Found in rails/db/migrate/20090127220427_rigse.rb - About 2 hrs to fix

          Method create has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def create
              authorize [:api, :v1, :external_activity]
          
              begin
                user, role = check_for_auth_token(params)
          Severity: Major
          Found in rails/app/controllers/api/v1/external_activities_controller.rb - About 2 hrs to fix

            Function handleKeyDown has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              handleKeyDown (e: any) {
                let handledKey = false;
                const { query, suggestions, selectedSuggestionIndex, showSuggestions } = this.state;
                const { onChange, onSubmit } = this.props;
                const suggestion = suggestions[selectedSuggestionIndex];
            Severity: Major
            Found in rails/react-components/src/library/components/search/auto-suggest.tsx - About 2 hrs to fix

              Method create_default_users has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def create_default_users
                default_admin_user_settings = APP_CONFIG[:default_admin_user]
              
                default_user_list = [
                  admin_user = User.where(:login => default_admin_user_settings [:login]).first_or_create(
              Severity: Major
              Found in rails/db/seeds.rb - About 2 hrs to fix

                Identical blocks of code found in 3 locations. Consider refactoring.
                Open

                  adapt: function() {
                    var dimensions = this.content.getScrollDimensions();
                    if (this.options.superflousEffects)
                      this.morph(dimensions, true);
                    else
                Severity: Major
                Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 2 other locations - About 2 hrs to fix
                rails/app/assets/javascripts/livepipe/window.js on lines 1682..1689
                rails/public/javascripts/light_box.js on lines 3430..3437

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

                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

                Identical blocks of code found in 3 locations. Consider refactoring.
                Open

                  setTheme: function(theme) {
                    this.stack.windows.select(function(w) {
                      return !w.options.theme;
                    }).invoke('setTheme', theme, true);
                    this.options.theme = theme;
                Severity: Major
                Found in rails/app/assets/javascripts/livepipe/window.js and 2 other locations - About 2 hrs to fix
                rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 4611..4617
                rails/public/javascripts/light_box.js on lines 4611..4617

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

                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