gems-uff/sapos

View on GitHub

Showing 381 of 381 total issues

Function Chronoline has a Cognitive Complexity of 244 (exceeds 5 allowed). Consider refactoring.
Open

function Chronoline(domElement, events, options) {
    this.VERSION = "0.1.1";

    var defaults = {
        defaultStartDate: null,  // the date furthest to the left on load. Defaults to today
Severity: Minor
Found in app/assets/javascripts/chronoline/chronoline.js - About 5 days 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 Chronoline has 598 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Chronoline(domElement, events, options) {
    this.VERSION = "0.1.1";

    var defaults = {
        defaultStartDate: null,  // the date furthest to the left on load. Defaults to today
Severity: Major
Found in app/assets/javascripts/chronoline/chronoline.js - About 2 days to fix

    File enrollments_pdf_helper.rb has 934 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module EnrollmentsPdfHelper
      def i18n_eht(key, *args)
        key = "pdf_content.enrollment.header." + key.to_s
        I18n.t(key, *args)
      end
    Severity: Major
    Found in app/helpers/enrollments_pdf_helper.rb - About 2 days to fix

      File chronoline.js has 693 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // chronoline.js v0.1.1
      // by Kevin Leung for Zanbato, https://zanbato.com
      // MIT license at https://github.com/StoicLoofah/chronoline.js/blob/master/LICENSE.md
      
          if (!Date.now) {
      Severity: Major
      Found in app/assets/javascripts/chronoline/chronoline.js - About 1 day to fix

        Method consolidate_phase has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
        Open

          def consolidate_phase
            i18n_prefix = "active_scaffold.admissions/admission_process.consolidate_phase"
            @admission_process = Admissions::AdmissionProcess.find(params[:id])
            @show_page = params[:show_summary]
            phase_id = params[:consolidate_phase_id].to_i
        Severity: Minor
        Found in app/controllers/admissions/admission_processes_controller.rb - About 7 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 prepare_class_schedule_table has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

          def prepare_class_schedule_table(
            course_classes, on_demand, advisement_authorizations = nil,
            keep_on_demand = false, used_to_render_a_pdf_report: false
          )
            advisement_authorizations ||= []
        Severity: Minor
        Found in app/helpers/concerns/class_schedule_helper_concern.rb - About 6 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 grades_report_table has 156 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def grades_report_table(pdf, options = {})
            enrollment ||= options[:enrollment]
            total_class_enrollments ||= options[:class_enrollments]
        
            table_width = [66, 215, 57, 57, 50, 50, 65]
        Severity: Major
        Found in app/helpers/enrollments_pdf_helper.rb - About 6 hrs to fix

          File admission_processes_controller.rb has 419 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class Admissions::AdmissionProcessesController < ApplicationController
            authorize_resource
            include ApplicationHelper
            include PdfHelper
          
          
          Severity: Minor
          Found in app/controllers/admissions/admission_processes_controller.rb - About 6 hrs to fix

            Method transcript_table has 148 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def transcript_table(pdf, options = {})
                class_enrollments ||= options[:class_enrollments]
            
                table_width = [66, 280, 57, 57, 50, 50]
            
            
            Severity: Major
            Found in app/helpers/enrollments_pdf_helper.rb - About 5 hrs to fix

              Method populate_field has 143 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def populate_field
                  @scope = params[:scope]
                  @parent_record = params[:id].nil? ?
                    new_parent_record : find_if_allowed(params[:id], :update)
              
              
              Severity: Major
              Found in app/controllers/admissions/form_templates_controller.rb - About 5 hrs to fix

                Method thesis_table has 140 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def thesis_table(curr_pdf, options = {})
                    data_table_rows = nil
                    data_table_rows_defense_committee = nil
                
                    curr_pdf.group do |pdf|
                Severity: Major
                Found in app/helpers/enrollments_pdf_helper.rb - About 5 hrs to fix

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

                      validate: () => {
                        let result = true;
                        if (options["required"] && !form_field.data[field]) {
                          let present_error = form_field.i18n_error(field + "_present_error");
                          $(`#${id}_error`).text(present_error)
                  Severity: Major
                  Found in app/assets/javascripts/form_fields/config_select.js and 1 other location - About 5 hrs to fix
                  app/assets/javascripts/form_fields/config_codemirror.js on lines 41..52

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

                  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

                      validate: () => {
                        let result = true;
                        if (options["required"] && !form_field.data[field]) {
                          let present_error = form_field.i18n_error(field + "_present_error");
                          $(`#${id}_error`).text(present_error)
                  Severity: Major
                  Found in app/assets/javascripts/form_fields/config_codemirror.js and 1 other location - About 5 hrs to fix
                  app/assets/javascripts/form_fields/config_select.js on lines 57..68

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

                  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(t.events.length > 0){
                              t.endDate = getEndDate(t.events[0].dates);
                              for(var i = 1; i < t.events.length; i++)
                                  if(getEndDate(t.events[i].dates) > t.endDate)
                                      t.endDate = getEndDate(t.events[i].dates);
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 5 hrs to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 261..274

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

                  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(t.events.length > 0){
                              t.startDate = t.events[0].dates[0];
                              for(var i = 1; i < t.events.length; i++)
                                  if(t.events[i].dates[0] < t.startDate)
                                      t.startDate = t.events[i].dates[0];
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 5 hrs to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 284..297

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

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

                    def create_bigint_migration
                      models = {}
                  
                      Dir["app/models/*"].each do |name|
                        model_name = name.match(/app\/models\/(.*?)\.rb/)[1].pluralize
                  Severity: Minor
                  Found in lib/generators/migrate_bigint_generator.rb - About 5 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 thesis_table has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def thesis_table(curr_pdf, options = {})
                      data_table_rows = nil
                      data_table_rows_defense_committee = nil
                  
                      curr_pdf.group do |pdf|
                  Severity: Minor
                  Found in app/helpers/enrollments_pdf_helper.rb - About 4 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 config_form_field_values has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function config_form_field_values(form_field, field, options) {
                    let r = (Math.random() + 1).toString(36).substring(7);
                    let visible = options["visible"] === false ? `style="display:none;"`: "";
                    let main_id = `${form_field.baseid}_${field}_main_id_${r}`
                    let div_id = `${form_field.baseid}_${field}_div_${r}`
                  Severity: Major
                  Found in app/assets/javascripts/form_fields/config_values.js - About 4 hrs to fix

                    Method search_table has 117 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def search_table(pdf, options = {})
                        search ||= options[:search]
                    
                        return if search.blank?
                        values = []
                    Severity: Major
                    Found in app/helpers/enrollments_pdf_helper.rb - About 4 hrs to fix

                      Method consolidate_phase has 117 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def consolidate_phase
                          i18n_prefix = "active_scaffold.admissions/admission_process.consolidate_phase"
                          @admission_process = Admissions::AdmissionProcess.find(params[:id])
                          @show_page = params[:show_summary]
                          phase_id = params[:consolidate_phase_id].to_i
                      Severity: Major
                      Found in app/controllers/admissions/admission_processes_controller.rb - About 4 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language