remomueller/contour

View on GitHub

Showing 26 of 40 total issues

Function buildDomStructure has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function buildDomStructure(input) {
            var $wrapper = $(html.wrapper), $dropdown = $(html.dropdown), $input = $(input), $hint = $(html.hint);
            $wrapper = $wrapper.css(css.wrapper);
            $dropdown = $dropdown.css(css.dropdown);
            $hint.css(css.hint).css({
Severity: Minor
Found in app/assets/javascripts/external/typeahead.js - About 1 hr to fix

    Function moveMonth has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            moveMonth: function(date, dir){
                if (!dir) return date;
                var new_date = new Date(date.valueOf()),
                    day = new_date.getUTCDate(),
                    month = new_date.getUTCMonth(),
    Severity: Minor
    Found in app/assets/javascripts/external/bootstrap-datepicker.js - About 1 hr to fix

      Method create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def create
          if signed_in?
            # TODO: Should use "Resource" and not "User"
            params[:user][:password] = params[:user][:password_confirmation] = Digest::SHA1.hexdigest(Time.now.usec.to_s)[0..19] if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
      
      
      Severity: Minor
      Found in app/controllers/contour/registrations_controller.rb - About 55 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/external/bootstrap-datepicker.js - About 45 mins to fix

        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/external/bootstrap-datepicker.js - About 45 mins to fix

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

            def create
              self.resource = warden.authenticate!(auth_options)
              set_flash_message(:notice, :signed_in) if is_flashing_format?
              sign_in(resource_name, resource)
              yield resource if block_given?
          Severity: Minor
          Found in app/controllers/contour/sessions_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

          Severity
          Category
          Status
          Source
          Language