skandragon/thing

View on GitHub

Showing 175 of 175 total issues

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

                    html.push('<span class="minute' + clsName + '">' + txt + ':' + (i < 10 ? '0' + i : i) + '</span>');
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 646..646

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

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

Avoid deeply nested control flow statements.
Open

                            } else if (target.is('.new')) {
                                if (month == 11) {
                                    month = 0;
                                    year += 1;
                                } else {
Severity: Major
Found in app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                    if (oldViewMode == this.viewMode && this.autoclose) {
                                        this.hide();
                                    }
    Severity: Major
    Found in app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js - About 45 mins to fix

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

        def index
          @allowed_tracks = Instructable::TRACKS.keys
          @track = params[:track]
      
          @proofread = params[:proofread]
      Severity: Minor
      Found in app/controllers/proofreader/instructables_controller.rb - About 45 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

      Avoid deeply nested control flow statements.
      Open

                                      if (month === 0) {
                                          month = 11;
                                          year -= 1;
                                      } else {
                                          month -= 1;
      Severity: Major
      Found in app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js - About 45 mins to fix

        Method formatted_nontrack_location has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def formatted_nontrack_location
            raise Exception.new("location_type is 'track' but no location known") unless location_nontrack?
            if location_type == 'private-camp'
              ret = [camp_name]
              ret << "(#{camp_address})" if camp_address.present?
        Severity: Minor
        Found in app/models/instructable.rb - About 45 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

        Avoid deeply nested control flow statements.
        Open

                                        if (this.autoclose) {
                                            this.hide();
                                        }
        Severity: Major
        Found in app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      update_column(:proofread, true) unless proofread
          Severity: Major
          Found in app/models/instructable.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                            if (this.viewSelect >= 3) {
                                                this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));
                                            }
            Severity: Major
            Found in app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          } else if (target.is('.year')) {
                                              this.viewDate.setUTCDate(1);
                                              year = parseInt(target.text(), 10) || 0;
                                              this.viewDate.setUTCFullYear(year);
                                              this.element.trigger({
              Severity: Major
              Found in app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js - About 45 mins to fix

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

                  def created_instances_for_date
                    @created_instances_for_date.sort { |a, b|
                      ret = a[:start_time] <=> b[:start_time]
                      ret = a[:name] <=> b[:name] if ret == 0
                      ret = a[:location] <=> b[:location] if ret == 0
                Severity: Minor
                Found in app/lib/csv_compare.rb and 1 other location - About 45 mins to fix
                app/lib/csv_compare.rb on lines 8..13

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

                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

                  def deleted_instances_for_date
                    @deleted_instances_for_date.sort { |a, b|
                      ret = a[:start_time] <=> b[:start_time]
                      ret = a[:name] <=> b[:name] if ret == 0
                      ret = a[:location] <=> b[:location] if ret == 0
                Severity: Minor
                Found in app/lib/csv_compare.rb and 1 other location - About 45 mins to fix
                app/lib/csv_compare.rb on lines 17..22

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

                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

                                    meridian = (hours < 12 ? dates[this.language].meridiem[0] : dates[this.language].meridiem[1]);
                app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 598..598

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

                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

                                    meridian = (i < 12 ? dates[this.language].meridiem[0] : dates[this.language].meridiem[1]);
                app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 629..629

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

                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

                    box_opts = {
                        at: [box.top_left[0] + 2, box.top_left[1] - 2],
                        width: box.width - 4,
                        height: box.height - 4,
                        size: 9,
                Severity: Minor
                Found in sched.rb and 1 other location - About 40 mins to fix
                sched.rb on lines 308..317

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

                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

                    box_opts = {
                        at: [box.top_left[0] + 2, box.top_left[1] - 2],
                        width: box.width - 4,
                        height: box.height - 4,
                        size: 10,
                Severity: Minor
                Found in sched.rb and 1 other location - About 40 mins to fix
                sched.rb on lines 347..356

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

                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

                    pdf.font_families.update(
                      'BodyFont' => {
                        normal: Rails.root.join('app', 'assets', 'fonts', 'Arial.ttf'),
                        bold: Rails.root.join('app', 'assets', 'fonts', 'Arial Bold.ttf'),
                        italic: Rails.root.join('app', 'assets', 'fonts', 'Arial Italic.ttf'),
                Severity: Minor
                Found in app/controllers/coordinator/locations_controller.rb and 1 other location - About 40 mins to fix
                app/lib/calendar_renderer.rb on lines 106..113

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

                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

                    pdf.font_families.update(
                        'Arial' => {
                          normal: Rails.root.join('app', 'assets', 'fonts', 'Arial.ttf'),
                          bold: Rails.root.join('app', 'assets', 'fonts', 'Arial Bold.ttf'),
                          italic: Rails.root.join('app', 'assets', 'fonts', 'Arial Italic.ttf'),
                Severity: Minor
                Found in app/lib/calendar_renderer.rb and 1 other location - About 40 mins to fix
                app/controllers/coordinator/locations_controller.rb on lines 77..84

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

                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

                Consider simplifying this complex logical expression.
                Open

                            if (arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) {
                                date = arguments[0];
                                fromArgs = true;
                            } else {
                                date = this.element.data('date') || (this.isInput ? this.element.val() : this.element.find('input').val()) || this.initialDate;
                Severity: Major
                Found in app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js - About 40 mins to fix

                  Method pdf_render_table has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def pdf_render_table(pdf, items, header, total_width, column_widths)
                  Severity: Minor
                  Found in app/lib/griffin_pdf.rb - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language