vegantech/sims

View on GitHub

Showing 433 of 433 total issues

Function show has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

Popup.prototype.show = function(options, modal) {
    this.modal = this.modal || (typeof(modal)=="boolean" && modal);
    if (defined(options) && options!=null && typeof(options)=="object") {
        for (var i in options) {
            this[i] = options[i];
Severity: Minor
Found in app/assets/javascripts/popup.js - 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 import has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def import
     return if append_failure?
     if clean_file
        if confirm_count?
          create_temporary_table
Severity: Minor
Found in lib/csv_importer/base.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 recommendation_buttons has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def recommendation_buttons(form)
  b=Recommendation::RECOMMENDATION.sort
  b[1],b[2] = b[2],b[1]   #No progress at current level should be the second element
   a=b.collect do |k,v|
     opts={}
Severity: Minor
Found in app/helpers/checklists_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 setup_ending_reminders has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def self.setup_ending_reminders(district = nil)
    errors = []
    users_with_interventions = Hash.new([])
    interventions_ending_this_week.each do |intervention|
      if district.blank? || intervention.participants_with_author.collect(&:user).compact.collect(&:district_id).include?(district.id)
Severity: Minor
Found in app/mailers/notifications.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 parse_range_option has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_range_option(option, direction)
      if option.is_a? Symbol
        case option
        when :today
          range_class = 'today'
Severity: Minor
Found in lib/unobtrusive_date_picker/unobtrusive_date_picker.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 make_date_picker_class_options has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def make_date_picker_class_options(options)
      html_classes = []

      if options[:highlight_days]
        highlight_days = parse_days_of_week(options[:highlight_days])
Severity: Minor
Found in lib/unobtrusive_date_picker/unobtrusive_date_picker.rb - About 1 hr to fix

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

                            o.date = new Date(o.low.substr(0,4), o.low.substr(4,2)-1, o.low.substr(6,2), 5, 0, 0);
    Severity: Major
    Found in app/assets/javascripts/datepicker.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/datepicker.js on lines 539..539

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

    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

                            o.date = new Date( o.high.substr(0,4), o.high.substr(4,2)-1, o.high.substr(6,2), 5, 0, 0);
    Severity: Major
    Found in app/assets/javascripts/datepicker.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/datepicker.js on lines 534..534

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

    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

                                            options.low  = options.low  ? range[0] + String(options.low).substr(4,4)  : datePickerController.dateFormat(range[0] + "/01/01");
    Severity: Major
    Found in app/assets/javascripts/datepicker.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/datepicker.js on lines 1420..1420

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

    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

                                            options.high = options.high ? range[1] + String(options.low).substr(4,4)  : datePickerController.dateFormat(range[1] + "/12/31");
    Severity: Major
    Found in app/assets/javascripts/datepicker.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/datepicker.js on lines 1419..1419

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

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

    function terminateSpell() {
        // called when we have reached the end of the spell checking.
        var msg = "Spell check complete:\n\n";
        var numrepl = this._getTotalReplaced();
        if( numrepl == 0 ) {
    Severity: Minor
    Found in app/assets/javascripts/spellerpages/spellChecker.js - About 1 hr to fix

      Function terminateSpell has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function terminateSpell() {
          // called when we have reached the end of the spell checking.
          var msg = "Spell check complete:\n\n";
          var numrepl = this._getTotalReplaced();
          if( numrepl == 0 ) {
      Severity: Minor
      Found in public/speller/spellChecker.js - About 1 hr to fix

        Method verify_externally has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def verify_externally(student,district)
        
        #   curl "https://uaapps.dpi.wi.gov/SIMS_Student_Location_Confirm/SIMS/nonsecure"
         #  -d wsn=9000000099 -d district=3456 -H "Accept: text/xml"
        
        
        Severity: Minor
        Found in lib/verify_student_in_district_externally.rb - About 1 hr to fix

          Method setup_from_checklist_or_definition has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def setup_from_checklist_or_definition
              if checklist
                self.recommendation_definition ||= checklist.checklist_definition.recommendation_definition if checklist
                self.district_id ||= checklist.district_id
                self.student_id ||= checklist.student_id
          Severity: Minor
          Found in app/models/recommendation.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 referral_report has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def referral_report
              csv_string = ''
              CSV.generate(csv_string,:row_sep=>"\r\n") do |csv|
                csv << ["personID","referral_request","main_concerns","interventions_tried","family_involvement","external_factors","date","schoolyear"]
                dates_of_sims_data.each do |student|
          Severity: Minor
          Found in lib/referral_report.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 update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def update
              params[:user] ||= {}
              @user = current_district.users.find(params[:id])
          
              respond_to do |format|
          Severity: Minor
          Found in app/controllers/district/users_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 generate_report has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def generate_report report_class, base_filename, report_options
              fmt = params[:report_params][:format]
              if report_class.class == Class
                @report = report_class.send("render_#{fmt}".to_sym, report_options)
              else
          Severity: Minor
          Found in app/controllers/reports_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

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

              if(!options.skipBefore) {      
                options.beforeInsert(newItem, insert);
                if(options.beforeInsert.length <= 1) {
                  insert();
                }
          Severity: Major
          Found in app/assets/javascripts/jquery.nested-fields.js and 1 other location - About 1 hr to fix
          app/assets/javascripts/jquery.nested-fields.js on lines 178..185

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

          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

              if(!options.skipBefore) {
                options.beforeRemove($element, remove);
                if(options.beforeRemove.length <= 1) {
                  remove();
                }
          Severity: Major
          Found in app/assets/javascripts/jquery.nested-fields.js and 1 other location - About 1 hr to fix
          app/assets/javascripts/jquery.nested-fields.js on lines 144..151

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

          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

          Method chart_page has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def chart_page(page=0)
                #      probe_scores
                #       scores, grouped by date?
          
                    low=page.to_i*group_size
          Severity: Minor
          Found in app/models/grouped_progress_entry/aggregate_chart.rb - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language