nukomeet/coworfing

View on GitHub

Showing 60 of 60 total issues

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

            if(this.hour_slider)
                this.hour_slider.slider("option", { min: this._defaults.hourMin, max: hourMax }).slider('value', this.hour);
Severity: Major
Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 3 other locations - About 1 hr to fix
lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 769..770
lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 771..772
lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 773..774

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

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

            var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
                maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
Severity: Major
Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 1 other location - About 1 hr to fix
lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 683..684

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

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

            if(this.minute_slider)
                this.minute_slider.slider("option", { min: this._defaults.minuteMin, max: minMax }).slider('value', this.minute);
Severity: Major
Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 3 other locations - About 1 hr to fix
lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 767..768
lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 771..772
lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 773..774

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

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

            var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
                minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
Severity: Major
Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 1 other location - About 1 hr to fix
lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 723..724

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

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

Function _doKeyPress has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

$.datepicker._doKeyPress = function(event) {
    var inst = $.datepicker._getInst(event.target),
        tp_inst = $.datepicker._get(inst, 'timepicker');

    if (tp_inst) {
Severity: Minor
Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 1 hr to fix

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

                    minMax  = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)) ,10),
    Severity: Major
    Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 3 other locations - About 55 mins to fix
    lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 762..762
    lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 764..764
    lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 765..765

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

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

                    secMax  = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)) ,10),
    Severity: Major
    Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 3 other locations - About 55 mins to fix
    lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 762..762
    lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 763..763
    lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 765..765

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

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

                    millisecMax  = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)) ,10);
    Severity: Major
    Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 3 other locations - About 55 mins to fix
    lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 762..762
    lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 763..763
    lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 764..764

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

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

                var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)) ,10),
    Severity: Major
    Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 3 other locations - About 55 mins to fix
    lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 763..763
    lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 764..764
    lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 765..765

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

    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 confirm_button_with_class has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def confirm_button_with_class(name, path, confirm_text, classes, disabled=false, method=:get)
    Severity: Minor
    Found in app/helpers/application_helper.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if (h == 0) tmph = 12 +'a';
                              else if (h < 12) tmph += 'a';
                              else tmph += 'p';
      Severity: Major
      Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if(this.millisec > this._defaults.millisecMax) this.millisec = this._defaults.millisecMax;
        Severity: Major
        Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                          if (aph == 12) h = 0;
                                          else h = aph;
          Severity: Major
          Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        } else if (aph == 12) h = 12;
                                        else h = aph + 12;
            Severity: Major
            Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if(this.millisec < this._defaults.millisecMin)
                                          this.millisec = this._defaults.millisecMin;
              Severity: Major
              Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 45 mins to fix

                Method location has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def location(location=[])
                      unless location.blank?
                        loc = location.is_a?(Array) ? location[0] : location
                        geo = Geocoder.search(loc.gsub("-", " "))[0]
                        if geo
                Severity: Minor
                Found in app/models/place.rb - About 35 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

                Method all has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def all
                    auth = request.env['omniauth.auth']
                  
                    # Find an identity here
                    @identity = Identity.find_with_omniauth(auth)
                Severity: Minor
                Found in app/controllers/omniauth_callbacks_controller.rb - About 35 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

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

                  def update
                    @user = current_user
                    email_changed = @user.email != params[:user][:email]
                    password_changed = false
                    if params[:user][:password]
                Severity: Minor
                Found in app/controllers/registrations_controller.rb - About 25 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

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

                  def works
                    @checkin = @place.checkins.where(user_id: current_user.id).first
                    if @checkin
                      @checkin.status = :works
                    else
                Severity: Minor
                Found in app/controllers/checkins_controller.rb and 1 other location - About 25 mins to fix
                app/controllers/checkins_controller.rb on lines 17..26

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

                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 worked
                    @checkin = @place.checkins.where(user_id: current_user.id).first
                    if @checkin
                      @checkin.status = :worked
                    else
                Severity: Minor
                Found in app/controllers/checkins_controller.rb and 1 other location - About 25 mins to fix
                app/controllers/checkins_controller.rb on lines 5..14

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

                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