Showing 22 of 30 total issues

Class Entity has 34 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Entity
    # rubocop:disable Metrics/ModuleLength, Naming/MethodName
    module Attributes
      # Schema: person
      def cn
Severity: Minor
Found in app/services/ldap/entity.rb - About 4 hrs to fix

    Class StudentCourseEnrollmentService has 27 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class StudentCourseEnrollmentService # rubocop:disable Metrics/ClassLength
      ECTS = 30
    
      CompulsoryCourseGroup = OpenStruct.new(name: 'compulsories', completed: false)
      EnrollableError       = Class.new(StandardError)
    Severity: Minor
    Found in app/services/student_course_enrollment_service.rb - About 3 hrs to fix

      Function exports has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function (api) {
        var validEnv = ['development', 'test', 'production']
        var currentEnv = api.env()
        var isDevelopmentEnv = api.env('development')
        var isProductionEnv = api.env('production')
      Severity: Major
      Found in babel.config.js - About 2 hrs to fix

        Function DynamicSelect has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var DynamicSelect = function (parameters) { // eslint-disable-line no-unused-vars
          var Store = {}
        
          function init () {
            $.each(parameters, function (k, parameter) {
        Severity: Major
        Found in app/assets/javascripts/helpers/dynamic_select.js - About 2 hrs to fix

          Method prospective_student_params has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def prospective_student_params
                params.require(:prospective_student).permit(
                  :academic_term_id,
                  :additional_score,
                  :address,

            Function OptionsBuilder has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            var OptionsBuilder = function (datas, config = {}) {
              var options = []
            
              function build () {
                if (options.length > 0) return options
            Severity: Minor
            Found in app/assets/javascripts/helpers/dynamic_select.js - 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 merge_keep! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                    def merge_keep!(other)
                      merge!(other)
                      self.class.members.each do |member|
                        next if (value = __send__(member)).nil?
                        next unless (member_string = member.to_s).end_with? SUFFIX_INDICATING_KEEP
            Severity: Minor
            Found in plugins/support/lib/nokul/support/structure.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 build_operations_for_update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                  def build_operations_for_update(entity)
                    current_values   = find_values_via_ldap(entity).with_indifferent_access
                    values           = entity.values.with_indifferent_access
                    operations       = []
            
            
            Severity: Minor
            Found in app/services/ldap/client.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

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

            var TelInputValidation = function (inputId, errorMsgId, errorMessages) { // eslint-disable-line no-unused-vars
              var input = document.querySelector(inputId)
              var errorMsg = document.querySelector(errorMsgId)
            
              var reset = function () {
            Severity: Minor
            Found in app/assets/javascripts/shared/intl_tel_input_validation.js - About 1 hr to fix

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

                  def load(fallback: DEFAULT_TENANT)
                    tenant = self.name = (ENV['NOKUL_TENANT'] || fallback)&.downcase
                    raise Error::LoadError, 'No tenant defined through NOKUL_TENANT environment' if tenant.blank?
                    raise Error::LoadError, 'Tenant "common" is not a concrete tenant' if tenant == 'common'
              
              
              Severity: Minor
              Found in plugins/tenant/common/lib/nokul/tenant.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 find_values_via_ldap has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def find_values_via_ldap(entity)
                      current_values = find_by(entity.dn, uid: entity.uid)
                      Entity::ATTRIBUTES.each_with_object({}) do |(attribute, type), hash|
                        value           = current_values.public_send(attribute.downcase)
                        hash[attribute] = (type == :single ? value.first : value)
              Severity: Minor
              Found in app/services/ldap/client.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 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def update
                    if user_params[:password].blank? || user_params[:password_confirmation].blank?
                      @user.update_without_password(user_params) ? redirect_with('.success') : render(:edit)
                    else
                      @user.update(user_params) ? redirect_with('.success') : render(:edit)
              Severity: Minor
              Found in app/controllers/user_management/users_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 create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def create
                    @prospective_employee = ProspectiveEmployee.new(prospective_employee_params)
                    prospective = FirstRegistration::ProspectiveService.new(@prospective_employee)
              
                    if prospective.register
              Severity: Minor
              Found in app/controllers/first_registration/prospective_employees_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 included has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                      def included(base)
                        super
              
                        # Support mixins as in the following use cases
              
              
              Severity: Minor
              Found in plugins/support/lib/nokul/support/structure.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 dynamic_search has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def dynamic_search(params = {})
                    raise ArgumentError, 'parameter must be Hash' unless [ActionController::Parameters, Hash].include?(params.class)
              
                    results = dynamic_where(params)
              
              
              Severity: Minor
              Found in app/models/concerns/dynamic_search.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 process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def process(page: 0)
                    response = Xokul::Yoksis::Prospectives.all(@type, @year, page: page) || {}
              
                    response.fetch(:data, []).each do |params|
                      Actions::ProspectiveStudent::Upsert.call(params.merge(year: @year), academic_term: @academic_term)
              Severity: Minor
              Found in app/jobs/yoksis/prospective_students_save_job.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 with_backup_and_notification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def with_backup_and_notification(new_file, **options, &block)
                    new_file_exist_before = File.exist? new_file
                    return if !with_backup(new_file, &block) || options[:quiet]
              
                    old_file_exist = File.exist? old_file = "#{new_file}.old"
              Severity: Minor
              Found in plugins/support/lib/nokul/support/utils/file_utils.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 save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def save
                    return redirect_with('not_draft_error') unless @assessment.draft?
                    return redirect_with('not_fully_graded_error') unless @assessment.fully_graded?
              
                    @assessment.update(status: :saved) ? redirect_with('success') : redirect_with('error')
              Severity: Minor
              Found in app/controllers/instructiveness/assessments_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 with_status_and_notification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def with_status_and_notification(new_file, **options, &block)
                    new_file_exist_before = File.exist? new_file
              
                    status = with_status(new_file, &block)
              
              
              Severity: Minor
              Found in plugins/support/lib/nokul/support/utils/file_utils.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 scope has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def scope(bypass: nil)
                      return model.all if bypass.nil? ? bypass? : bypass
              
                      query = Query::Builder.call(self)
              
              
              Severity: Minor
              Found in app/lib/patron/scope/base.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