skandragon/thing

View on GitHub

Showing 175 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

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

          DPGlobal.templateV3 = '<div class="datetimepicker">' +
              '<div class="datetimepicker-minutes">' +
              '<table class=" table-condensed">' +
              DPGlobal.headTemplateV3 +
              DPGlobal.contTemplate +
      app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 1603..1639

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

      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

          DPGlobal.template = '<div class="datetimepicker">' +
              '<div class="datetimepicker-minutes">' +
              '<table class=" table-condensed">' +
              DPGlobal.headTemplate +
              DPGlobal.contTemplate +
      app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 1640..1676

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

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

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

                                                  case 'MM':
                                                      filtered = $(dates[language].months).filter(function () {
                                                          var m = this.slice(0, parts[i].length),
                                                              p = parts[i].slice(0, m.length);
                                                          return m == p;
                      app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 1446..1453

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

                      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

                                                  case 'M':
                                                      filtered = $(dates[language].monthsShort).filter(function () {
                                                          var m = this.slice(0, parts[i].length),
                                                              p = parts[i].slice(0, m.length);
                                                          return m == p;
                      app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 1438..1445

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language