skandragon/thing

View on GitHub

Showing 175 of 175 total issues

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

        if ('startView' in options) {
            this.startViewMode = options.startView;
        } else if ('startView' in this.element.data()) {
            this.startViewMode = this.element.data('start-view');
        }
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 74..78
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 81..85
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 89..93
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 97..101
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 105..109
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 112..116
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 128..132
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 136..140
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 182..186
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 189..193

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

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 11 locations. Consider refactoring.
Open

        if ('wheelViewModeNavigation' in options) {
            this.wheelViewModeNavigation = options.wheelViewModeNavigation;
        } else if ('wheelViewModeNavigation' in this.element.data()) {
            this.wheelViewModeNavigation = this.element.data('view-mode-wheel-navigation');
        }
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 74..78
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 81..85
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 89..93
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 105..109
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 112..116
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 119..123
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 128..132
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 136..140
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 182..186
app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 189..193

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

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 render_topic_list has 46 lines of code (exceeds 25 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 1 hr to fix

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

                        if (this.viewMode != 0) {
                            var oldViewMode = this.viewMode;
                            this.showMode(-1);
                            this.fill();
                            if (oldViewMode == this.viewMode && this.autoclose) {
    app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 906..918

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

    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

                                if (this.viewMode != 0) {
                                    var oldViewMode = this.viewMode;
                                    this.showMode(-1);
                                    this.fill();
                                    if (oldViewMode == this.viewMode && this.autoclose) {
    app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 1158..1170

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

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

      def self.conflicts(options = {})
        #
        # If options[:track] then limit returned conflicts to instances
        # that involve that track in some way.  Unfortunately, we still need
        # to retrieve all the instances which have a start_time set, because
    Severity: Minor
    Found in app/lib/conflict_check.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

    Method changes_since has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.changes_since(date = nil)
        date = Time.zone.parse('20130511T075500Z') if date.blank?
    
        changes = Changelog.where(target_type: 'Instructable').where('created_at >= ?', date).order(:created_at).group_by(&:target_id)
    
    
    Severity: Minor
    Found in app/models/changelog.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

    Method render_xlsx has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def render_xlsx(options, filename)
        @options = options
        @options = {} if @options.nil?
    
        p = Axlsx::Package.new
    Severity: Minor
    Found in app/lib/calendar_renderer.rb - About 1 hr to fix

      Function _attachEvents has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              _attachEvents: function () {
                  this._detachEvents();
                  if (this.isInput) { // single input
                      this._events = [
                          [this.element, {
      Severity: Minor
      Found in app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js - About 1 hr to fix

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

                moveHour: function (date, dir) {
                    if (!dir) return date;
                    var new_date = new Date(date.valueOf());
                    //dir = dir > 0 ? 1 : -1;
                    new_date.setUTCHours(new_date.getUTCHours() + dir);
        app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 1006..1012

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

        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

                            if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()
                                && month <= this.startDate.getUTCMonth()
                                && day <= this.startDate.getUTCDate()
        app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 712..714

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

        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

                moveDate: function (date, dir) {
                    if (!dir) return date;
                    var new_date = new Date(date.valueOf());
                    //dir = dir > 0 ? 1 : -1;
                    new_date.setUTCDate(new_date.getUTCDate() + dir);
        app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 998..1004

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

        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

                            if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()
                                && month <= this.startDate.getUTCMonth()
                                && day <= this.startDate.getUTCDate()) {
        app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 694..696

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

        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 render_pdf has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def render_pdf
            @pdf = Prawn::Document.new(page_size: 'LETTER', page_layout: :portrait,
              :compress => true, :optimize_objects => true,
              :info => {
                :Title => "Pennsic University #{Pennsic.year} Instructor Signup",
        Severity: Minor
        Found in app/controllers/admin/reports_controller.rb - About 1 hr to fix

          Method generate_differences has 40 lines of code (exceeds 25 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 1 hr to fix

            Method render_extra has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            def render_extra(pdf, opts)
              rowoffset = opts[:rowoffset]
            
              #box = pdf.grid([rowoffset, 0], [pdf.grid.rows - 1, pdf.grid.columns - 1])
              box = pdf.grid([rowoffset, 0], [rowoffset + 0.2, pdf.grid.columns - 1])
            Severity: Minor
            Found in sched.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

            Method update has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              def update
                respond_to do |format|
                  format.json {
                    if params.has_key?(:published)
                      @user.schedule.published = params[:published]
            Severity: Minor
            Found in app/controllers/users/schedules_controller.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

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

                                if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()
                                    && month >= this.endDate.getUTCMonth()
                                    && day >= this.endDate.getUTCDate()
            app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 719..721

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

            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

                                if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()
                                    && month >= this.endDate.getUTCMonth()
                                    && day >= this.endDate.getUTCDate()) {
            app/assets/javascripts/datetimepicker/bootstrap-datetimepicker.js on lines 702..704

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

            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 send_email_on_delete
                user_address = @instructable.user.email
                admin_addresses = User.where(admin: true).pluck(:email)
                admin_addresses -= [user_address]
            
            
            Severity: Major
            Found in app/controllers/instructables_controller.rb and 1 other location - About 1 hr to fix
            app/controllers/instructables_controller.rb on lines 111..128

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

            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