concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

Method register has a Cognitive Complexity of 12 (exceeds 5 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: Minor
Found in rails/app/controllers/api/v1/students_controller.rb - About 1 hr 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 detailed_learner_info has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def self.detailed_learner_info(learner)
    teacherIds = learner.teachers_id
    teachers = teacherIds.each_with_index.map do |id, i|
      {
        user_id: id,
Severity: Minor
Found in rails/app/controllers/api/v1/report_learners_es_controller.rb - About 1 hr 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 build_onSearch_message has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def build_onSearch_message(form_model)
    investigations_count = form_model.total_entries['Investigation'] || 0
    activities_count = form_model.total_entries['Activity'] || 0
    interactives_count = form_model.total_entries['Interactive'] || 0
    show_message_onSearch= ""
Severity: Minor
Found in rails/app/helpers/search_helper.rb - About 1 hr 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 batch_import_status has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def batch_import_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 1 hr 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 bulk_update has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def bulk_update
    class_id = params[:class_id]
    student_ids = params[:student_ids]
    add_permission_form_ids = params[:add_permission_form_ids] || []
    remove_permission_form_ids = params[:remove_permission_form_ids] || []
Severity: Minor
Found in rails/app/controllers/api/v1/permission_forms_controller.rb - About 1 hr 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 truncate_xhtml has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def truncate_xhtml
        if (self.respond_to? 'name')
          self.html_tables.each do |tablename|
            if self.respond_to? tablename
              truncated_xhtml = truncate_from_xhtml(self.send(tablename))
Severity: Minor
Found in rails/lib/truncatable_xhtml.rb - About 1 hr 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 changeable? has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def changeable?(user)
    # the Anonymous user can't change anything, always return false
    if(user.anonymous?)
      return false

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

  def create
    authorize ExternalActivity
    @external_activity = ExternalActivity.new(external_activity_strong_params(params[:external_activity]))
    @external_activity.user = current_visitor

Severity: Minor
Found in rails/app/controllers/external_activities_controller.rb - About 1 hr 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 getQueryParams has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  getQueryParams () {
    const params: any = { remove_cc_teachers: this.state.removeCCTeachers };
    for (const filter of ["teachers", "cohorts", "runnables"]) {
      if ((this.state[filter] != null ? this.state[filter].length : undefined) > 0) {
        params[filter] = this.state[filter].map((v: any) => v.value).sort().join(",");

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 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const { dataProvider } = this.state;

    if (!dataProvider) {
      return <div>Loading</div>;
Severity: Minor
Found in admin-panel/react-admin-interface/src/App.js - About 1 hr to fix

    Function hideBorder has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        hideBorder: function() {
            var el = this.targetElement,
                cs = el.currentStyle,
                rs = el.runtimeStyle,
                tag = el.tagName,
    Severity: Minor
    Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js - About 1 hr to fix

      Function parseString has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        parseString: function(dateString, format) {
          var date = new Date(), i18n = Date.default_i18n;
      
          format=format.replace('%D','%m/%d/%y');
          format=format.replace('%T','%H:%M:%S').replace('%r','%I:%M:%S %p').replace('%R','%H:%M:%S');
      Severity: Minor
      Found in rails/public/javascripts/light_box.js - About 1 hr to fix

        Function parseString has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          parseString: function(dateString, format) {
            var date = new Date(), i18n = Date.default_i18n;
        
            format=format.replace('%D','%m/%d/%y');
            format=format.replace('%T','%H:%M:%S').replace('%r','%I:%M:%S %p').replace('%R','%H:%M:%S');
        Severity: Minor
        Found in rails/public/javascripts/light_box.js - About 1 hr to fix

          Function BgSize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          PIE.BgSize = (function() {
          
              var CONTAIN = 'contain',
                  COVER = 'cover',
                  AUTO = 'auto';
          Severity: Minor
          Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js - About 1 hr to fix

            Function preview_home_page has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function preview_home_page(homePageContentId, homePageContent){
                var previewContent = null;
            
                if(homePageContentId){
                    previewContent = $(homePageContentId).value;
            Severity: Minor
            Found in rails/app/assets/javascripts/preview_home_page.js - About 1 hr to fix

              Function parseString has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                parseString: function(dateString, format) {
                  var date = new Date(), i18n = Date.default_i18n;
              
                  format=format.replace('%D','%m/%d/%y');
                  format=format.replace('%T','%H:%M:%S').replace('%r','%I:%M:%S %p').replace('%R','%H:%M:%S');
              Severity: Minor
              Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js - About 1 hr to fix

                Function parseString has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  parseString: function(dateString, format) {
                    var date = new Date(), i18n = Date.default_i18n;
                
                    format=format.replace('%D','%m/%d/%y');
                    format=format.replace('%T','%H:%M:%S').replace('%r','%I:%M:%S %p').replace('%R','%H:%M:%S');
                Severity: Minor
                Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js - About 1 hr to fix

                  Function preview_about_page has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function preview_about_page(aboutPageContentId, aboutPageContent){
                      var previewContent = null;
                  
                      if(aboutPageContentId){
                          previewContent = $(aboutPageContentId).value;
                  Severity: Minor
                  Found in rails/app/assets/javascripts/preview_about_page.js - About 1 hr to fix

                    Function keydown_checker has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        Chosen.prototype.keydown_checker = function(evt) {
                          var stroke, _ref1;
                          stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
                          this.search_field_scale();
                          if (stroke !== 8 && this.pending_backstroke) {
                    Severity: Minor
                    Found in rails/app/assets/javascripts/chosen.proto.js - About 1 hr to fix

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

                        def create
                          authorize ExternalActivity
                          @external_activity = ExternalActivity.new(external_activity_strong_params(params[:external_activity]))
                          @external_activity.user = current_visitor
                      
                      
                      Severity: Minor
                      Found in rails/app/controllers/external_activities_controller.rb - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language