vicvega/chaltron

View on GitHub

Showing 11 of 13 total issues

Method populate_banners has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def populate_banners
      ret = []

      ret << <<-'END'
_________ .__           .__   __
Severity: Major
Found in lib/chaltron/banner.rb - About 3 hrs to fix

    Function NavbarBuilder has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function NavbarBuilder() {
    
      function renderDropdownMenu(item){
        var i, ref;
        ref = $(item).find('ul li a');
    Severity: Major
    Found in app/assets/javascripts/chaltron/navbar.js - About 2 hrs to fix

      Function NavbarBuilder has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      function NavbarBuilder() {
      
        function renderDropdownMenu(item){
          var i, ref;
          ref = $(item).find('ul li a');
      Severity: Minor
      Found in app/assets/javascripts/chaltron/navbar.js - About 2 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 find_users has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

              def find_users(args)
                return [] if args.empty?
                limit = args.delete(:limit)
                fields = args.keys
      
      
      Severity: Minor
      Found in lib/chaltron/ldap/connection.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 custom_tls_options has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

              def custom_tls_options
                return {} unless options['tls_options']
      
                # Dup so we don't overwrite the original value
                custom_options = options['tls_options'].dup.delete_if { |_, value| value.nil? || value.blank? }
      Severity: Minor
      Found in lib/chaltron/ldap/connection.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 tls_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def tls_options
                return @tls_options if defined?(@tls_options)
      
                method = translate_method
                return unless method
      Severity: Minor
      Found in lib/chaltron/ldap/connection.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

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

          def role_select(opts = {})
            collection = Chaltron.roles.map { |role| [role, I18n.translate("roles.#{role}")] }
            checked = @object.nil?? false : @object.roles
            html = inputs_collection(:roles, collection, :first, :last, checked: checked) do |name, value, options|
              options[:multiple] = true
      Severity: Minor
      Found in lib/chaltron/form_builder/bootstrap_form.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 ldap_search has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def ldap_search(*args)
                results = ldap.search(*args)
                if results.nil?
                  response = ldap.get_operation_result
                  unless response.code.zero?
      Severity: Minor
      Found in lib/chaltron/ldap/connection.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 display_username has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def display_username(user, link = true)
          capture do
            if link
              concat link_to(user.username, user)
            else
      Severity: Minor
      Found in app/helpers/chaltron/users_helper.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 find_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def find_options
          department = params[:department]
          name       = params[:lastname]
          limit      = params[:limit].to_i
      
      
      Severity: Minor
      Found in app/controllers/chaltron/ldap_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

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

              def find_or_create(auth, create)
                @auth = auth
                if uid.blank? || email.blank? || username.blank?
                  raise_error('Account must provide a dn, uid and email address')
                end
      Severity: Minor
      Found in lib/chaltron/ldap/user.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