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

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

              enum index: {
                ssci:                       5,
                sci_expanded:               6,
                ahci:                       7,
                field_indexes:              8,
            Severity: Major
            Found in app/models/article.rb and 1 other location - About 1 hr to fix
            app/services/ldap/entity.rb on lines 202..229

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

            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

                ATTRIBUTES = {
                  cn:                          :single,
                  displayName:                 :single,
                  eduPersonAffiliation:        :multiple,
                  eduPersonPrimaryAffiliation: :single,
            Severity: Major
            Found in app/services/ldap/entity.rb and 1 other location - About 1 hr to fix
            app/models/article.rb on lines 12..39

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

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

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

                    def non_graduates
                      data     = Xokul::UBS::Statistic::Student.non_graduates
                      @degrees = data.pluck(:degree).uniq!
                      @series  = data.group_by { |item| item[:status] }.map do |status, values|
                        {
              Severity: Minor
              Found in app/controllers/manager/stats/students_controller.rb and 1 other location - About 55 mins to fix
              app/controllers/manager/stats/students_controller.rb on lines 43..52

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

              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 genders_and_degrees
                      data     = Xokul::UBS::Statistic::Student.by_genders_and_degree
                      @degrees = data.pluck(:degree).uniq!
                      @series  = data.group_by { |item| item[:gender] }.map do |gender, values|
                        {
              Severity: Minor
              Found in app/controllers/manager/stats/students_controller.rb and 1 other location - About 55 mins to fix
              app/controllers/manager/stats/students_controller.rb on lines 56..65

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

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

              Severity
              Category
              Status
              Source
              Language