vegantech/sims

View on GitHub

Showing 223 of 433 total issues

Function jsWrapper has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        jsWrapper: function(tableid, colNums) {
                if(!(tableid in fdTableSort.tmpCache)) { return false; };
                if(!(tableid in fdTableSort.tableCache)) { fdTableSort.prepareTableData(document.getElementById(tableid)); };
                if(!(colNums instanceof Array)) { colNums = [colNums]; };
Severity: Minor
Found in app/assets/javascripts/tablesort.js - About 1 hr to fix

    Function hide has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    Popup.prototype.hide = function() {
        // If this was a temp object creating on-the-fly, then remove objects from the DOM so
        // The document doesn't get littered with extra objects
        if (this.destroyDivOnHide) {
            DOM.removeNode(this.div);
    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 link_to_if_authorized has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def link_to_if_authorized(name, options = {}, html_options = {}, *rest)
        #TODO Test then Refactor!!!     This is a spike.
       # hsh = ::ActionController::Routing::Routes.recognize_path url.gsub(/\?.*$/,''), :method=> :get
        if options.is_a?String
          url = options
    Severity: Minor
    Found in app/helpers/application_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

    Function replaceAll has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function replaceAll() {
        var ti = this.currentTextIndex;
        var wi = this.currentWordIndex;
        if( !this.wordWin ) {
            alert( 'Error: Word frame not available.' );
    Severity: Minor
    Found in public/speller/spellChecker.js - About 1 hr to fix

      Function getEnabledDates has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              o.getEnabledDates = function(y, m) {
                      var obj = {};
                      var d = datePicker.getDaysPerMonth(m - 1, y);
                      m = m < 10 ? "0" + String(m) : m;
                      var day,tmp,de,me,ye,disabled;
      Severity: Minor
      Found in app/assets/javascripts/datepicker.js - About 1 hr to fix

        Function replaceAll has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function replaceAll() {
            var ti = this.currentTextIndex;
            var wi = this.currentWordIndex;
            if( !this.wordWin ) {
                alert( 'Error: Word frame not available.' );
        Severity: Minor
        Found in app/assets/javascripts/spellerpages/spellChecker.js - About 1 hr to fix

          Function _spellcheck has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function _spellcheck() {
              var ww = this.wordWin;
              
              // check if this is the last word in the current text element
              if( this.currentWordIndex == ww.totalWords( this.currentTextIndex) ) {
          Severity: Minor
          Found in public/speller/spellChecker.js - About 1 hr to fix

            Function addScreen has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Popup.prototype.addScreen = function() {
                if (this.screen==null) {
                    this.screen = this.createDiv();
                    this.screen.style.top="0px";
                    this.screen.style.left="0px";
            Severity: Minor
            Found in app/assets/javascripts/popup.js - About 1 hr to fix

              Function _spellcheck has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function _spellcheck() {
                  var ww = this.wordWin;
                  
                  // check if this is the last word in the current text element
                  if( this.currentWordIndex == ww.totalWords( this.currentTextIndex) ) {
              Severity: Minor
              Found in app/assets/javascripts/spellerpages/spellChecker.js - About 1 hr to fix

                Method flags has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def self.flags
                    pids = `ps wx |grep -v grep |grep 'runner' |grep 'PrimeCache'| grep -v 'nice' |cut -f 1 -d' '`
                    if pids.split("\n").size > 1
                      puts "Script already running"
                      exit 0
                Severity: Minor
                Found in lib/prime_cache.rb - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                                          if(inp.className && (inp.className.search(regExp6) != -1 || inp.className.search(/split-date/) != -1) && ((inp.tagName.toLowerCase() == "input" && (inp.type == "text" || inp.type == "hidden")) || inp.tagName.toLowerCase() == "select")) {
                  
                                                  if(inp.id && document.getElementById('fd-'+inp.id)) { continue; };
                                                  
                                                  if(!inp.id) { inp.id = "fdDatePicker-" + uniqueId++; };
                  Severity: Major
                  Found in app/assets/javascripts/datepicker.js - About 1 hr to fix

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

                    function _spellcheck() {
                        var ww = this.wordWin;
                        
                        // check if this is the last word in the current text element
                        if( this.currentWordIndex == ww.totalWords( this.currentTextIndex) ) {
                    Severity: Minor
                    Found in public/speller/spellChecker.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 whom has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def whom
                        if @whom
                          @whom
                        else
                          w = []
                    Severity: Minor
                    Found in app/models/consultation_form_request.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 set_defaults_from_definition has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def set_defaults_from_definition
                        return unless new_record?
                    
                        if intervention_definition.blank? || intervention_definition.new_record?
                          self.frequency ||= Frequency.find_by_title('Weekly')
                    Severity: Minor
                    Found in app/models/intervention.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 score_element has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def score_element(element)
                        if element.kind=="scale" and !element_definitions_for_answers.include?(element) then
                          @score_results[element.question_definition][element] = "A value must be picked"
                        elsif element.kind=="sa" and !element_definitions_for_answers.include?(element) then
                          @score_results[element.question_definition][element]= "Text must be entered"
                    Severity: Minor
                    Found in app/models/checklist_scorer.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 _spellcheck has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function _spellcheck() {
                        var ww = this.wordWin;
                        
                        // check if this is the last word in the current text element
                        if( this.currentWordIndex == ww.totalWords( this.currentTextIndex) ) {
                    Severity: Minor
                    Found in app/assets/javascripts/spellerpages/spellChecker.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 expire_cache_for has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def expire_cache_for(obj)
                        if obj.respond_to?(:objective_definitions)
                          return nil if obj.district.blank?
                          obj.objective_definitions.each{|o| expire_cache_for_objective_definition(o)}
                          obj.district.touch
                    Severity: Minor
                    Found in app/sweepers/intervention_builder_sweeper.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 populate_from_csv_file has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def populate_from_csv_file(parent,model_name,parent_id_sym, parenthash ={})
                        Hash.new.tap do |reshash|
                          CSV.table("#{path}/#{model_name.pluralize}.csv").each do |ck|
                            next unless ckhash = prephash(ck)
                            ckhash[parent_id_sym]= parenthash[ck[parent_id_sym]] unless parenthash.empty?
                    Severity: Minor
                    Found in lib/training_district/content.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 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def create
                        params[:team_consultation] ||= {}
                        params[:team_consultation].merge!(:student_id => current_student_id, :requestor_id => current_user.id)
                        params[:team_consultation][:draft] = true if params[:commit] == "Save as Draft"   #the js in the view stopped working?
                        @team_consultation = TeamConsultation.new(params[:team_consultation])
                    Severity: Minor
                    Found in app/controllers/team_consultations_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 enforce_session_selections has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def enforce_session_selections
                        return true unless params[:id]
                            # raise "I'm here" if selected_students_ids.nil?
                        if selected_student_ids and selected_student_ids.include?(params[:id])
                          self.current_student_id=params[:id]
                    Severity: Minor
                    Found in app/controllers/students_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

                    Severity
                    Category
                    Status
                    Source
                    Language