skandragon/thing

View on GitHub

Showing 91 of 175 total issues

File bootstrap-datetimepicker.js has 1543 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* =========================================================
 * bootstrap-datetimepicker.js
 * =========================================================
 * Copyright 2012 Stefan Petre
 * Improvements by Andrew Rowls
Severity: Major
Found in app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js - About 4 days to fix

    File sched.rb has 730 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'rubygems'
    
    require 'prawn'
    require 'json'
    require 'pp'
    Severity: Major
    Found in sched.rb - About 1 day to fix

      Method render_pdf has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
      Open

        def render_pdf(options, filename, cache_filename = nil, user = nil)
          @options = options
          @options = {} if @options.nil?
          @options.reverse_merge!({
            user: nil,
      Severity: Minor
      Found in app/lib/calendar_renderer.rb - About 1 day 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_differences has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
      Open

        def generate_differences(a = original, b = committed)
          return [a.class.name, nil] if !a.nil? && b.nil?
          return [nil, b.class.name] if !b.nil? && a.nil?
      
          differences = {}
      Severity: Minor
      Found in app/models/changelog.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

      Function click has 170 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              click: function (e) {
                  e.stopPropagation();
                  e.preventDefault();
                  var target = $(e.target).closest('span, td, th, legend');
                  if (target.length == 1) {
      Severity: Major
      Found in app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js - About 6 hrs to fix

        Function fill has 168 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                fill: function () {
                    if (this.date == null || this.viewDate == null) {
                        return;
                    }
                    var d = new Date(this.viewDate),
        Severity: Major
        Found in app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js - About 6 hrs to fix

          Method show has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
          Open

            def show
              # TODO: need to handle format here, and return an empty schedule for ICS requests
              # where the user does exist, 404 where it does not, and redirect for html requests.
          
              raise ActiveRecord::RecordNotFound.new('Not Found') unless @user
          Severity: Minor
          Found in app/controllers/users/schedules_controller.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 render_pdf has 155 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def render_pdf(options, filename, cache_filename = nil, user = nil)
              @options = options
              @options = {} if @options.nil?
              @options.reverse_merge!({
                user: nil,
          Severity: Major
          Found in app/lib/calendar_renderer.rb - About 6 hrs to fix

            Function Datetimepicker has 146 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var Datetimepicker = function (element, options) {
                    var that = this;
            
                    this.element = $(element);
            
            
            Severity: Major
            Found in app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js - About 5 hrs to fix

              Method check_for_proofread_changes has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
              Open

                def check_for_proofread_changes
                  return true if @is_proofreader and @is_proofreader == :no_really
              
                  needs_clearing = false
                  changes.keys.each do |field_name|
              Severity: Minor
              Found in app/models/instructable.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

              File instructable.rb has 389 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class Instructable < ApplicationRecord
                belongs_to :user
                has_many :instances, -> { order('start_time, location') }, dependent: :destroy
                has_many :changelogs, as: :target
                accepts_nested_attributes_for :instances, allow_destroy: true
              Severity: Minor
              Found in app/models/instructable.rb - About 5 hrs to fix

                Function parseDate has 132 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        parseDate:        function (date, format, language, type) {
                            if (date instanceof Date) {
                                var dateUTC = new Date(date.valueOf() - date.getTimezoneOffset() * 60000);
                                dateUTC.setMilliseconds(0);
                                return dateUTC;
                Severity: Major
                Found in app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js - About 5 hrs to fix

                  Function keydown has 123 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          keydown: function (e) {
                              if (this.picker.is(':not(:visible)')) {
                                  if (e.keyCode == 27) // allow escape to hide and re-show picker
                                      this.show();
                                  return;
                  Severity: Major
                  Found in app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js - About 4 hrs to fix

                    File calendar_renderer.rb has 361 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'csv'
                    
                    class CalendarRenderer
                      include GriffinPdf
                      include GriffinMarkdown
                    Severity: Minor
                    Found in app/lib/calendar_renderer.rb - About 4 hrs to fix

                      Method render_topic_list has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def render_topic_list(pdf, instructables)
                        previous_topic = ''
                      
                        instructables.sort { |a, b|
                          [a.formatted_topic, a.name.gsub('*', '')] <=> [b.formatted_topic, b.name.gsub('*', '')]
                      Severity: Minor
                      Found in sched.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

                      Method index has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def index
                          render_options = {}
                      
                          respond_to do |format|
                            uncached = params[:uncached_for_tests].present?
                      Severity: Minor
                      Found in app/controllers/calendars_controller.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

                      Method render has 107 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      def render(pdf, opts)
                        debug = false
                      
                        if debug
                          pdf.stroke_axis
                      Severity: Major
                      Found in sched.rb - About 4 hrs to fix

                        Method render_ics has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def render_ics(options, filename, cache_filename = nil)
                            @options = options
                            @options = {} if options.nil?
                            @options.reverse_merge!({
                              calendar_name: "Pennsic #{Pennsic.year} Master Schedule",
                        Severity: Minor
                        Found in app/lib/calendar_renderer.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

                        Class Instructable has 30 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Instructable < ApplicationRecord
                          belongs_to :user
                          has_many :instances, -> { order('start_time, location') }, dependent: :destroy
                          has_many :changelogs, as: :target
                          accepts_nested_attributes_for :instances, allow_destroy: true
                        Severity: Minor
                        Found in app/models/instructable.rb - About 3 hrs to fix

                          File changelog.rb has 319 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          class Changelog < ApplicationRecord
                            belongs_to :user
                            belongs_to :target, polymorphic: true
                          
                            default_scope { where(year: 2032) }
                          Severity: Minor
                          Found in app/models/changelog.rb - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language